因此,我将路由中的frontName定义为ICA,我的控制器文件夹是Index以及控制器类名。输入' magento2 / ICA / index / index'返回404未找到。不确定我缺少什么
路线:
<?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 id="ICA_Route" frontName="ica_deliveries">
<module name="ICA_HelloWorld"/>
</route>
</router>
控制器类:
<?php
namespace ICA\HelloWorld\Controller\Index;
use Magento\Framework\App\Action\Context;
class Index extends \Magento\Framework\App\Action\Action
{
protected $_resultPageFactory;
public function __construct(Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory)
{
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
public function execute()
{
$resultPage = $this->_resultPageFactory->create();
return $resultPage;
}
}
?>
答案 0 :(得分:0)
您可以使用以下网址结构来执行您的控制器
www.domain.com/frontName/actionpath/actionclass/