Zend_Framework 并添加一个前置的“目录”;到网址
我有一个 ZF 应用程序,想在 url 结构中添加一个“目录”,使 url 为:
http://domain.com/location/show/id/1 -> http://domain.com/app/location/show/id/1
我希望从主机根 (domain.com) 提供该应用程序,因为有一组漂亮的 url 项目 http ://domain.com/promo 映射到 http://domain.com/promo/show/name/:promo
有办法吗以某种方式将其注入路由器?
谢谢
编辑 - 这适用于所有控制器,我正在按照第一个答案的思路思考,但理想情况下希望能够以更直接的方式将某些东西推入其中
I have a ZF app and would like to add a 'directory' to the url structure such that the urls are:
http://domain.com/location/show/id/1 -> http://domain.com/app/location/show/id/1
I would like the app to be served from the host root (domain.com) since there are a set of pretty url'd items http://domain.com/promo that get mapped to http://domain.com/promo/show/name/:promo
Is there a way to inject this into the Router somehow?
thx
edit - this would be for all controllers, I was thinking along the lines of first answer but would ideally like to be able to just push something in there in a more straightforward way
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许最简单的方法是使用 Zen_Router 在应用程序中创建内部路由(我对 Zend_Router 不太了解,所以我不能更具体),另一种选择是使用模块构建应用程序,而不是使用_forward 实用程序在操作和控制器之间进行内部移动。
Maybe the easiest way is to use the Zen_Router to create internal routes in your application (I don't know much about Zend_Router so I can't be more specific), another option is to structure your application using modules, than you could use the _forward utility to move internally between actions and controllers.