Zend框架路由器404错误


Zend framework router 404 error

这是我的zend框架模块配置:

 '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和如下描述:

"请求的控制器无法映射到现有的控制器类…"。

有什么问题吗?

尝试将'type' => 'segment'更改为'type' => 'Segment'