开发者

Convert REQUEST_URI to route (Zend Framework)

开发者 https://www.devze.com 2023-01-01 15:32 出处:网络
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.

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

精彩评论

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

关注公众号