[英]How do I add multiple module directories in Zend Framework?
I'm working on a Zend project where there is a need to make it easily extendable.我正在做一个需要使其易于扩展的 Zend 项目。 Having considered various options, I think it would work best if these extensions used the same MVC structure as generic Zend modules but were grouped together in a seperate folder away from the core modules.
考虑了各种选择后,我认为如果这些扩展使用与通用 Zend 模块相同的 MVC 结构但在远离核心模块的单独文件夹中组合在一起,那将是最好的。
So the structure I would ideally like would be something like:所以我理想中想要的结构是这样的:
application
configs
core
module1
module2
extensions
extensionModule1
extensionModule2
Then with this structure I'd like urls such as module1/controller/action
and extensionModule1/controller/action
to both work at the same time.然后使用这种结构,我希望
module1/controller/action
和extensionModule1/controller/action
等 url 同时工作。
So is it possible to setup multiple module directories for the router to look in?那么是否可以设置多个模块目录供路由器查看?
If this isn't possible, then any suggestions of another way to implement extensions that use MVC and are seperate from the core part of the site would be greatly appreciated.如果这不可能,那么将不胜感激关于使用 MVC 实现扩展并与站点的核心部分分开的另一种方法的任何建议。
Thanks for the help.谢谢您的帮助。
open your application.ini do打开你的 application.ini 做
resources.frontController.moduleDirectory[] = APPLICATION_PATH "/core" resources.frontController.moduleDirectory[] = APPLICATION_PATH "/extensions" resources.modules = true;
ZF will look in both the directories and will consider all there sub directories as modules. ZF 将查看这两个目录并将所有子目录视为模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.