简体   繁体   English

如何使用zend路由设置默认模块?

[英]How to set default module with zend route?

I've three module 我有三个模块

  • default 默认
  • frontend 前端
  • backend 后端

I'd like to hide default and frontend module from the url 我想隐藏网址中的默认和前端模块

So I'd like to set the module depending on the controller 所以我想根据控制器设置模块

because the defautl module is only used for errorController 因为defautl模块仅用于errorController

Thank you 谢谢

You can specify default controller directories by doing something like this: 您可以通过执行以下操作来指定默认控制器目录:

$front->setControllerDirectory('../application/modules/default/controllers');

To do it in the application config file: 要在应用程序配置文件中执行此操作:

resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/default/controllers"

This will allow the error controller to be accessed by by both modules. 这将允许两个模块访问错误控制器。

To change the default route, you'll need to add this to your routes.ini and change the modules/controllers. 要更改默认路由,您需要将其添加到routes.ini并更改模块/控制器。

routes.index.type = "Zend_Controller_Router_Route"
routes.index.route = "/"
routes.index.defaults.module = "default"
routes.index.defaults.controller = "index"
routes.index.defaults.action = "index"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM