开发者

change request uri before set controller and action in Zend

开发者 https://www.devze.com 2023-03-12 06:30 出处:网络
I am doing a web in开发者_如何转开发 Zend Framework. I wanna it for being multilanguage so in the structure controller/action I wanna add a uri parameter like this:

I am doing a web in开发者_如何转开发 Zend Framework. I wanna it for being multilanguage so in the structure controller/action I wanna add a uri parameter like this:

domain.com/en/controller/action

But obviusly Zend try to get controller with name en. How can I modify the requestUri before Zend set the controller name and the action name?

Thanks


You can create your own routes for this, begin with something like this in your application.ini:

resources.router.routes.default.route = ":language/:controller/:action"
resources.router.routes.default.defaults.controller = "index"
resources.router.routes.default.defaults.action = "index"

More information on the Zend website: The Standard Router

0

精彩评论

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

关注公众号