开发者

optional zend route

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜