这是我的阻止文件:
<?php
namespace ChennaiBox\Mymail\Block\Mail;
class MailContent extends \Magento\Framework\View\Element\Template
{
protected $_objectManager;
protected $customerSession;
public function __construct(
\Magento\Customer\Model\Session $customerSession,
\Magento\Framework\ObjectManagerInterface $objectManager
) {
$this->customerSession = $customerSession;
$this->_objectManager = $objectManager;
}
public function mymailData()
{
try{
if ($this->customerSession->isLoggedIn()) {
$cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail();
echo $cutomerEmail;
else{
$this->_redirect('customer/account/login/');
}
}catch (Exception $e) {
$e->getMessage();
}
}
}
如果我叫这个方块我会出错
PHP致命错误:调用到/var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php成员函数派遣()在零线642,引用者: HTTP://magentodev.gworks .mobi / magento2 / customer / account / index /
从apache error.log
文件中提取。为什么,建议我如何解决此问题。