application.ini 中的 Zend Framework 路由链接

发布于 2024-09-26 05:26:58 字数 1690 浏览 4 评论 0原文

我根据域名设置语言(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城缀染半城烟沙 2024-10-03 05:26:58

您尚未为 plain1 指定默认模块、控制器和操作。

You have not specified default module, controller and action for plain1.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文