zf3 skeleton application not working when change module.config.php of Application module

一曲冷凌霜 提交于 2019-12-13 03:26:02

问题


zf3 not work well when change route of Appliation module

download a zf3 skeleton application ,change route of zf3

'router' => [
    'routes' => [
        'home' => [
            'type' => Literal::class,
            'options' => [
                'route'    => '/',
                'defaults' => [
                    'controller' => Controller\IndexController::class,
                    'action'     => 'index',
                ],
            ],
        ],
        'application' => [
            'type'    => Segment::class,
            'options' => [
                'route'    => '/application[/:action]',
                'defaults' => [
                    'controller' => Controller\IndexController::class,
                    'action'     => 'index',
                ],
            ],
        ],
    ],
],

I change it to :

'router' => [
    'routes' => [
        'home' => [
            'type' => Literal::class,
            'options' => [
                'route'    => '/test',
                'defaults' => [
                    'controller' => Controller\IndexController::class,
                    'action'     => 'index',
                ],
            ],
        ],
        'application' => [
            'type'    => Segment::class,
            'options' => [
                'route'    => '/testapplication[/:action]',
                'defaults' => [
                    'controller' => Controller\IndexController::class,
                    'action'     => 'index',
                ],
            ],
        ],
    ],
],

when i visit /test and /testapplication/index , i got 404 page not found error, it seems zf3 can't route to this path


回答1:


If you installed the skeleton app and run it without touching anything, then the problem is the cache.

If you look in the application config file (config/application.config.php), you will find these lines:

return [
    'module_listener_options' => [
        // Line 33
        'config_cache_enabled' => true
    ]
];

This will create a cache file under the cache directory (by default, data/cache, as defined in application.config.php at line 47).

For development purposes, I suggest you to disable the cache. The best way to do that is to remove the .dist from the config/development.config.php.dist configuration file.



来源:https://stackoverflow.com/questions/56857834/zf3-skeleton-application-not-working-when-change-module-config-php-of-applicatio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!