[英]Route module on subdomain in Zend Framework
I'm having trouble getting the Zend_Controller_Router_Route_Hostname
to work properly. 我在使
Zend_Controller_Router_Route_Hostname
正常工作时遇到麻烦。
I'm using Zend Framework 1.9.4 我正在使用Zend Framework 1.9.4
In my config I have: 在我的配置中,我有:
resources.router.routes.www.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.www.route = ":module.domain"
resources.router.routes.www.defaults.module = "frontend"
resources.router.routes.www.chains.index.type = "Zend_Controller_Router_Route"
resources.router.routes.www.chains.index.route = ":controller/:action/*"
resources.router.routes.www.chains.index.defaults.controller = "index"
resources.router.routes.www.chains.index.defaults.action = "index"
At first look it seems to work just fine. 乍一看,它看起来还不错。 I have two modules:
我有两个模块:
services.domain
admin.domain
and the default module frontend, answers to everything else that does not exist. 和默认的模块前端,可以回答所有其他不存在的问题。
I can access services.domain/mycontroller/myaction/
and i get the right controller and action, from the right module. 我可以访问
services.domain/mycontroller/myaction/
,并从正确的模块中获得正确的控制器和操作。
But here comes my problem: I can't specify parameters. 但是我的问题来了:我无法指定参数。 Fx if i go to:
外汇,如果我去:
services.domain/mycontroller/myaction/key1/value1/key2/value2
I will get an invalid controller exception, because it then tries to find mycontroller in the frontend module - not the services module. 我将收到无效的控制器异常,因为它随后尝试在前端模块(而不是服务模块)中找到mycontroller。
I tried messing around with the Zend_Controller_Router_Route
and tell it to recieve a specific param - this works just fine, however i just want to be able to have all params dynamiclly like the default setup. 我尝试弄乱
Zend_Controller_Router_Route
并告诉它接收特定的参数-这很好,但是我只希望能够像默认设置一样动态地拥有所有参数。
What's wrong with my setup? 我的设置有什么问题?
After a good day of hunting, I figured out that it's not me, it's a bug that has already been submitted several months ago. 经过一整天的狩猎,我发现不是我,这是一个已经在几个月前提交的错误。
http://framework.zend.com/issues/browse/ZF-6654 http://framework.zend.com/issues/browse/ZF-6654
I can just hope this helps someone else. 我只是希望这可以帮助其他人。
The fix for this bug will be released on 26/Jan/10. 该错误的修复程序将于10年1月26日发布。
See here: http://framework.zend.com/issues/browse/ZF/fixforversion/10360 参见此处: http : //framework.zend.com/issues/browse/ZF/fixforversion/10360
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.