Magento2致命错误:未捕获类型错误:参数2传递给Gogoesho
我的代码显示此错误,任何人都可以帮助我,非常感谢 致命错误:未捕获的TypeError:参数2传递给 Gogoeshop\ProductWarranty\Controller\Index\Index::\uu构造()必须 是Magento\Customer\Model\Session的实例,是 Magento\Framework\View\Result\PageFactory已给定,已调用 C:\Apache-2.4.7-win64-VC11\htdocs\magentopos2\generated\code\Gogoeshop\ProductWarranty\Controller\Index\Index\Interceptor.php 第14行,并在中定义 C:\Apache-2.4.7-win64-VC11\htdocs\magentopos2\app\code\Gogoeshop\ProductWarranty\Controller\Index\Index.php:9 堆栈跟踪:#0 C:\Apache-2.4.7-win64-VC11\htdocs\magentopos2\generated\code\Gogoeshop\ProductWarranty\Controller\Index\Index\Interceptor.php(14): Gogoeshop\ProductWarranty\Controller\Index\Index->\uu构造(对象(Magento\Framework\App\Action\Context), 对象(Magento\Framework\View\Result\PageFactory))#1 C:\Apache-2.4.7-win64-VC11\htdocs\magentopos2\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(111): Gogoeshop\ProductWarranty\Controller\Index\Index\Interceptor->\uu构造(对象(Magento\Framework\App\ 在里面 C:\Apache-2.4.7-win64-VC11\htdocs\magentopos2\app\code\Gogoeshop\ProductWarranty\Controller\Index\Index.php 第9行Magento2致命错误:未捕获类型错误:参数2传递给Gogoesho,magento2,Magento2,我的代码显示此错误,任何人都可以帮助我,非常感谢 致命错误:未捕获的TypeError:参数2传递给 Gogoeshop\ProductWarranty\Controller\Index\Index::\uu构造()必须 是Magento\Customer\Model\Session的实例,是 Magento\Framework\View\Result\PageFactory已给定,已调用 C:\Apache-2.4.7-win64-VC11\htdocs\magentopos2\generat
尝试用以下命令编译代码:
php-bin/magento-setup:di:compile
。我希望它有帮助。只需使用命令行模式运行以下命令
rm -rf var/generation/*
通常,Magento将构造函数缓存在
var/generation
文件夹中,因此如果清除var/generation
内容,Magento将重新生成拦截器
rm -rf var/generation
我有同样的问题,并通过以下步骤解决它 首先,您需要删除生成的/code/*和var/cache/*
rm -rf generated/code/* var/cache/*
第二,清理缓存
php bin/magento cache:clean
第三,更改文件权限
sudo chmod 777 -R generated/ var/ pub/
第四,运行生成的编译代码
php bin/magento setup:di:compile
逐个运行以下命令:-
rm -rf var/*
rm -rf generated
php bin/magento setup:di:compile
遇到同样的错误,如何解决问题?@Girase Priyanka