相关疑难解决方法(0)

Zend框架无法路由已翻译的子路由

我是Zend框架3的新手,并试图翻译路线,我已经部分成功.我能够翻译主路线并将其重定向到所需的位置,但对于子路线,翻译工作但重定向不起作用.能帮到我吗,我的代码如下.

module.config.php

'router' => [
        'router_class'           => TranslatorAwareTreeRouteStack::class,
        'routes' => [
            'setting' => [
                'type'    => Segment::class,
                'options' => [
                    'route' => '/{locale}/{setting}',

                    'defaults' => [
                        'locale'     => 'de',
                        'controller' => Controller\SettingController::class,
                        'action'     => 'index',
                    ],
                ],

                'may_terminate'=>true,
                 'child_routes' =>[
                        'add' =>[
                            'type'      =>'Segment',
                            'options'   =>[
                                'route'         =>'/{add}',
                                'defaults'=> [
                                     'controller' => Controller\SettingController::class,
                                     'action'     => 'add',
                                ],
                            ],  
                        ],
                 ],
            ],
        ],
    ],
Run Code Online (Sandbox Code Playgroud)

Module.php

   public function onBootstrap(MvcEvent $e)
    {
        $eventManager        = $e->getApplication()->getEventManager();
        $moduleRouteListener = new ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);

        $language_session = new …
Run Code Online (Sandbox Code Playgroud)

php zend-translate zend-route zend-framework2 zend-framework3

5
推荐指数
1
解决办法
476
查看次数