0
这里是我的Zend框架模块配置:Zend框架路由器404错误
'routes' => [
'home' => [
'type' => Literal::class,
'options' => [
'route' => '/',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
],
'default' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
'constraints' => [
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
]
),
)
...
'controllers' => [
'factories' => [
Controller\IndexController::class => InvokableFactory::class,
],
和我IndexController.php看起来是这样的:
class IndexController extends AbstractActionController
{
public function indexAction()
{
return new ViewModel();
}
public function testAction()
{
echo 1;
return 1;
}
}
我希望得到一个正确的反应,当我访问http://host/Index/test
,但现在我得到一个404 error
和描述,如:
“请求的控制器不能映射到现有控制器类...“。
什么问题?