application.ini 中的 Zend Framework 路由链接
我根据域名设置语言(en 表示 en.example.com,tr 表示 tr.example.com):
resources.router.routes.plain.type = "Zend_Controller_Router_Route"
resources.router.routes.plain.route = "/:module/:controller/:action"
resources.router.routes.plain.defaults.language= "en"
resources.router.routes.plain.defaults.module = "content"
resources.router.routes.plain.defaults.controller = "index"
resources.router.routes.plain.defaults.action = "index"
resources.router.routes.plain1.type = "Zend_Controller_Router_Route"
resources.router.routes.plain1.abstract = 1
resources.router.routes.plain1.route = "/:module/:controller/:action/*"
resources.router.routes.plain.defaults.module = "content"
resources.router.routes.plain.defaults.controller = "index"
resources.router.routes.plain.defaults.action = "index"
resources.router.routes.dom0.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.dom0.abstract = 1
resources.router.routes.dom0.route = "en.example.com"
resources.router.routes.dom0.defaults.language= "en"
resources.router.routes.chn1.type = Zend_Controller_Router_Route_Chain
resources.router.routes.chn1.chain = "dom0, plain1"
resources.router.routes.dom1.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.dom1.abstract = 1
resources.router.routes.dom1.route = "tr.example.com"
resources.router.routes.dom1.defaults.language= "tr"
resources.router.routes.chn2.type = Zend_Controller_Router_Route_Chain
resources.router.routes.chn2.chain = "dom1, plain1"
这里的问题是当我仅使用模块名调用 url 而不指定控制器或操作时: tr.example.com/content/ 我将语言设置为“en”
但是当我使用模块名称、控制器和操作进行调用时: tr.example.com/content/article/read 一切都很好
我做错了什么?
提前致谢
I am setting language depending on the domain name (en for en.example.com, tr for tr.example.com):
resources.router.routes.plain.type = "Zend_Controller_Router_Route"
resources.router.routes.plain.route = "/:module/:controller/:action"
resources.router.routes.plain.defaults.language= "en"
resources.router.routes.plain.defaults.module = "content"
resources.router.routes.plain.defaults.controller = "index"
resources.router.routes.plain.defaults.action = "index"
resources.router.routes.plain1.type = "Zend_Controller_Router_Route"
resources.router.routes.plain1.abstract = 1
resources.router.routes.plain1.route = "/:module/:controller/:action/*"
resources.router.routes.plain.defaults.module = "content"
resources.router.routes.plain.defaults.controller = "index"
resources.router.routes.plain.defaults.action = "index"
resources.router.routes.dom0.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.dom0.abstract = 1
resources.router.routes.dom0.route = "en.example.com"
resources.router.routes.dom0.defaults.language= "en"
resources.router.routes.chn1.type = Zend_Controller_Router_Route_Chain
resources.router.routes.chn1.chain = "dom0, plain1"
resources.router.routes.dom1.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.dom1.abstract = 1
resources.router.routes.dom1.route = "tr.example.com"
resources.router.routes.dom1.defaults.language= "tr"
resources.router.routes.chn2.type = Zend_Controller_Router_Route_Chain
resources.router.routes.chn2.chain = "dom1, plain1"
the problem here is when I call url only with modulename and without specifying controller or action:
tr.example.com/content/
I get the language set to "en"
But when I call with modulename, controller and action:
tr.example.com/content/article/read
everything is fine
What do I do wrong?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尚未为 plain1 指定默认模块、控制器和操作。
You have not specified default module, controller and action for plain1.