开发者

optional zend route

开发者 https://www.devze.com 2023-03-28 13:43 出处:网络
I have a Zend app using a custom route: $router->addRoute( \'search\', new Zend_Controller_Router_Route(\'sea开发者_StackOverflow中文版rch/:s/*\',array(

I have a Zend app using a custom route:

        $router->addRoute(
                'search',
                new Zend_Controller_Router_Route('sea开发者_StackOverflow中文版rch/:s/*',array(
                            'module' => 'public',
                            'controller' => 'post',
                            'action' => 'search'

                    ));

        $router2->addRoute(
                'search',
                new Zend_Controller_Router_Route('search/:s/type/:controller/*',array(
                            'module' => 'public',
                            'controller' => 'post',
                            'action' => 'search'

                    ));

But i wanna know if it's possible to make "type/:controller" optional (and a default value for controller asignated) and unificate these two rules in one so that It works for:

mydomain/search/prueba => controller is post and action is search mydomain/search/prueba/type/event => controller is event and action is search

0

精彩评论

暂无评论...
验证码 换一张
取 消