获取sessionObj
use Magento\Framework\ObjectManagerInterface;
/**
* @var ObjectManagerInterface
*/
protected $_objectManager;
/**
* @param Context $context
*/
public function __construct(Context $context)
{
parent::__construct($context);
$this->_objectManager = $context->getObjectManager();
$this->_eventManager = $context->getEventManager();
$this->_url = $context->getUrl();
$this->_actionFlag = $context->getActionFlag();
$this->_redirect = $context->getRedirect();
$this->_view = $context->getView();
$this->messageManager = $context->getMessageManager();
}
public function getSession() {
return $this->_objectManager->get('Magento\Framework\Session\Storage');
}