Zend框架子域问题
我正在使用 .ini 文件在我的应用程序中添加路由。
resources.router.routes.username.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.username.route = ":username.example.com"
resources.router.routes.username.defaults.module = "userinfo"
resources.router.routes.username.chains.index.type = "Zend_Controller_Router_Route"
resources.router.routes.username.chains.index.route = ":language/:controller/:action/*"
resources.router.routes.username.chains.index.defaults.controller = "index"
resources.router.routes.username.chains.index.defaults.action = "index"
1) http://john.example.com/fr/controller/action
2) http://john.example.com/fr/controller/action/id/10
#1 网址有效。此处请求参数
Request Parameters:
array (
'language' => 'fr',
'controller' => 'controller',
'action' => 'action',
'username' => 'john',
'module' => 'userinfo',
)
#2 url 不起作用。在这里请求参数
Request Parameters:
array (
'controller' => 'fr',
'action' => 'controller',
'module' => 'default',
)
任何人都可以为此建议一个解决方案。
I am using .ini file to add routes in my application.
resources.router.routes.username.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.username.route = ":username.example.com"
resources.router.routes.username.defaults.module = "userinfo"
resources.router.routes.username.chains.index.type = "Zend_Controller_Router_Route"
resources.router.routes.username.chains.index.route = ":language/:controller/:action/*"
resources.router.routes.username.chains.index.defaults.controller = "index"
resources.router.routes.username.chains.index.defaults.action = "index"
1) http://john.example.com/fr/controller/action
2) http://john.example.com/fr/controller/action/id/10
#1 url it's work. Request parameter here
Request Parameters:
array (
'language' => 'fr',
'controller' => 'controller',
'action' => 'action',
'username' => 'john',
'module' => 'userinfo',
)
#2 url it's not work. Request parameter here
Request Parameters:
array (
'controller' => 'fr',
'action' => 'controller',
'module' => 'default',
)
Can anyone suggest a solution for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否为路线设置了默认语言?说它不起作用你能提供更多细节吗?
我遇到了一些类似的问题,Zend_navigation 没有接受语言参数,并且总是切换到我定义的默认语言。
最终我必须通过在自定义插件的 routshutdown 中手动设置默认语言来破解它,如果有帮助请参阅我的帖子
Zend Framework:Zend_translate 和路由相关问题
did you set a default language for the route? by saying it doesn't work could you provide more details?
I ran into some similar problem with Zend_navigation not taking in the language param and always switch to the default lang that i defined.
Eventually i have to hack it by manually setting default language in the routshutdown in a custom plugin please see my post if it helps
Zend Framework: Zend_translate and routing related issue
我在路由中添加默认语言参数。但这个网址不起作用
I add to default language parameter in route. But this url not work
看起来路线已重置为默认值。 之前遇到了这个问题
我在创建插件并注册到前端控制器 。在那里定义dispatchLoopStartup(),尝试设置语言参数或模块名称,
看看是否可以带回正确的路由。
Looks like the route has been reset to default. I run into that before
create a plugin and register to the front controller. Define dispatchLoopStartup() in there try set the language parameter or module name using
see if you can bring back the correct route.