Zend 框架模块、控制器、操作特定路线
在我的 zend 框架应用程序中,我有路由和默认值,例如:
resources.router.routes.plain.defaults.module = "index"
resources.router.routes.plain.defaults.controller = "index"
resources.router.routes.plain.defaults.action = "index"
我希望能够更改任何模块、控制器或操作的默认路由 例如,
让我们假设这个模块/控制器/操作结构:
content --- article --- read
--- write
--- news --- list
--- write
user --- auth --- signin
--- signout
--- access --- check
--- update
在这个架构中,
对于我想要的模块=内容 controller=article 作为默认控制器并且 action=read 为默认操作。
如果选择了controller=news,那么action=list将成为
我想要的module=用户的 默认操作 controller=auth 为默认控制器,action=signin 为默认操作。 如果选择controller=access,则action=check 将成为默认操作。
那么可以在application.ini中做到这一点吗?这个例子又如何呢?
提前致谢。
In my zend framework application, I have routes and defaults like:
resources.router.routes.plain.defaults.module = "index"
resources.router.routes.plain.defaults.controller = "index"
resources.router.routes.plain.defaults.action = "index"
I want to be able to change default routes for any module or controller or action
e.g.
Let's assume this module/controller/action structure:
content --- article --- read
--- write
--- news --- list
--- write
user --- auth --- signin
--- signout
--- access --- check
--- update
in this architecture,
for module=content I want
controller=article to be default controller and
action=read to be default action.
if controller=news is chosen then action=list becomes default action
for module= user I want
controller=auth to be default controller and action=signin to be default action.
if controller=access is chosen then action=check becomes default action.
So is it possible to do this in application.ini? And how for this example?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
随机想法:
您可以为每个模块定义一条默认指向这些特定操作的路由。
您还可以定义
Module_IndexController::preDispatch()
或User_AccessController::indexAction()
,使用_forward
将请求发送到正确的“ default":来自 Zend 框架文档 - 控制器实用方法
Random Thoughts:
You could define a route for each module that points to those specific actions as defaults.
You could also define an
Module_IndexController::preDispatch()
orUser_AccessController::indexAction()
that uses_forward
to send the request to the proper "default":From Zend Framework Documentation - Controller Utility Methods