0

我的module.config.php文件是

....... other route and setting .....

     'doctors' => array(
                'type' => 'segment',
                'options' => array(
                    'route'    => '/doctors',
                    'defaults' => array(
                        'controller' => 'Application\Controller\Index',
                        'action'     => 'doctors',
                    ),                    
                ),
                'may_terminate' => true,
                'child_routes' => array( 
                    'filter' => array(
                        'type'    => 'segment',
                        'options' => array(
                                'route'    => '/:type/:search',
                                'defaults' => array(
                                    'controller' => 'Application\Controller\Index',
                                    'action'     => 'doctors',
                                ),
                                'constraints' => array(
                                   // 'search' => '[a-z0-9]+', 
                                    'type' => '[a-z0-9]+', 
                                ), 
                                'defaults'    => array(),
                            ), 
                    ) , 
                )

            ), 

....... other route and setting .....  

我对这条路线的bjyauthorize配置是

 array('route' => 'doctors', 'roles' => array('admin' , 'doctor' , 'staff' , 'user', 'dps', 'vender' , 'ops' , 'crm' , 'analytic','editer'  , 'guest' ) ),

现在我的问题是

我可以访问

http://BASEURL/doctors

但我无法访问(未授权)

http://BASEURL/doctors/city/Car-Nicobar

任何人都可以帮我做到这一点。?

请让我知道您想了解更多设置。

4

1 回答 1

1

这几天遇到了类似的问题。您需要像这样在父路由之后指定 child_routes 名称。

旧代码:

array('route' => 'doctors', 'roles' => array('admin' , 'doctor' , 'staff' , 'user', 'dps', 'vender' , 'ops' , 'crm' , 'analytic','editer' , 'guest' ) ),

新代码:

array('route' => 'doctors/filter', 'roles' => array('admin' , 'doctor' , 'staff' , 'user', 'dps', 'vender' , 'ops' , 'crm' , 'analytic','editer' , 'guest' ) ),

于 2015-08-16T08:26:31.343 回答