开发者

Create route with Zend_Controller_Router_Route_Regex

I have one route defined in application.ini like

router.routes.xx.route = "y/:var/:controller/:action/*"
router.routes.xx.defaults.controller = "page"
router.routes.xx.defaults.action = "index"

I try to create one more route, which must take contol under urls

  1. Which consist of only from one word ( www.bla.pl/myname )
  2. This word is not eqivalent word 'excep开发者_如何学编程t' ( www.bla.pl/except -- dont process)
  3. transform www.bla.pl/myname into www.bla.pl/c?var=myname ( controller c with some action a and puts value 'myname' into parameter var )

I tried to write

router.routes.w.type  = "Zend_Controller_Router_Route_Regex"
router.routes.w.route = "(\w)+[^?|/]"
router.routes.w.reverse = "c/var=%s"
router.routes.w.defaults.controller = "c"
router.routes.w.defaults.action = "index"
router.routes.w.map.var = 1

What do i do wrong ?


Why don't you just use a normal route ?

router.routes.w.route = "/:var"
router.routes.w.route.defaults.controller = "c"
router.routes.w.route.defaults.action = "index"
router.routes.w.reqs.var = "!(your|forbidden|words)"

This should work as expected

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜