Is there a built in method in Zend Framework to convert a REQUEST_URI to its route name?
I want to know if ZF dispatches my request to a route, what route is taken for that specific request.
For example, this is my routes.ini:
routes.about.route = ":lang/about-my-company"
routes.about.defaults.controller = index
routes.about.defaults.action = about
routes.contact.route = ":lang/contact"
routes.contact.defaults.co开发者_开发百科ntroller = index
routes.contact.defaults.action = contactform
In this case: /en/about-my-company I want this as return value: about. Because that's the name of the route.
Found the answer:
Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName()
精彩评论