开发者

Convert REQUEST_URI to route (Zend Framework)

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()
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜