我有兩個途徑Zend的路由器優先
; category route
resources.router.routes.category.type = "Zend_Controller_Router_Route"
resources.router.routes.category.route = "shopping/:idTwo/:id/*"
resources.router.routes.category.defaults.module = "default"
resources.router.routes.category.defaults.controller = "shopping"
resources.router.routes.category.defaults.action = "category"
resources.router.routes.category.reqs.id = \w+
resources.router.routes.category.reqs.id = \d+
; searchroute
resources.router.routes.search.type = "Zend_Controller_Router_Route"
resources.router.routes.search.route = "shopping/search/:id/*"
resources.router.routes.search.defaults.module = "default"
resources.router.routes.search.defaults.controller = "shopping"
resources.router.routes.search.defaults.action = "search"
resources.router.routes.search.reqs.id = \w+
類別路由必須與像http://mrc.localhost/shopping/Childrens-Clothing/98的URL匹配,並且它是工作的罰款
搜索路徑必須像網址http://mrc.localhost/shopping/search/dvd+box+set 和http://mrc.localhost/shopping/search/123匹配。
搜索路徑工作正常的URL,它不具有關鍵字(:ID)像http://mrc.localhost/shopping/search/dvd+box+set一個整數,但如果關鍵字只是整數然後類別路由器把precende像網址http://mrc.localhost/shopping/search/123,因此類行爲被調用,而不是搜索行動,因爲你會看到:idTwo可以是任何字符串,它與「搜索」匹配,因此使用類別路由,但我希望搜索路由被使用,無論關鍵字是什麼。
感謝您的幫助。 – 2010-09-30 14:44:03