我遇到一個(gè)問(wèn)題,當(dāng)我嘗試瀏覽新模塊時(shí)找不到它。這是代碼的詳細(xì)信息。Ced/CsTermsAndServices/etc/Module.xml<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Ced_TermsAndServices" setup_version="1.0.0"> </module></config>Ced/CsTermsAndServices/registration.php<?PHP \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Ced_TermsAndServices', __DIR__ );Ced/CsTermsAndServices/etc/frontend/routes.xml<?xml version="1.0" ?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="standard"> <route frontName="cstermsandservices" id="cstermsandservices"> <module name="Ced_TermsAndServices"/> </route> </router></config>Ced/CsTermsAndServices/Controller/Index/Index.php<?phpnamespace Ced\CsTermsAndServices\Controller\Index;class Index extends \Magento\Framework\App\Action\Action{ protected $_pageFactory; public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $pageFactory) { $this->_pageFactory = $pageFactory; return parent::__construct($context); } public function execute() { echo "Hello World"; exit; }}預(yù)期的路線(xiàn)應(yīng)該是 http://localhost/cstermsandservices/index/index但結(jié)果卻是404 not found。有什么解決辦法嗎?
1 回答

蕪湖不蕪
TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超7個(gè)贊
1)確保遵循供應(yīng)商/模塊名稱(chēng)供應(yīng)商模塊名稱(chēng)約定(在您的情況下,如果您想遵循當(dāng)前目錄結(jié)構(gòu),模塊名稱(chēng)應(yīng)為Ced_CsTermsAndServices)2)module.xml文件名應(yīng)全部小寫(xiě)
希望這能成功 Magento 快樂(lè)
- 1 回答
- 0 關(guān)注
- 133 瀏覽
添加回答
舉報(bào)
0/150
提交
取消