简体   繁体   English

在zend框架中添加自定义控制器目录

[英]adding custom controller directory in zend framework

so in the index.php I did 所以在index.php中,我做了

$front = Zend_Controller_Front::getInstance();
$front = $front->addControllerDirectory('/path/to/directory');

and then I placed one of my controller files in that /path/to/directory 然后将我的控制器文件之一放在该/ path / to /目录中

but then Zend complains that it couldn't find that controller... 但后来Zend抱怨找不到控制器...

What did I do wrong? 我做错了什么?

from zend manual : 从zend手册:

Note: If you use addControllerDirectory() without a module name, it will set the directory for the default module -- overwriting it if it already exists. 注意:如果使用不带模块名称的addControllerDirectory(),它将为默认模块设置目录-如果该目录已经存在,则将其覆盖。

so specify the module name where your custom controllers are if it's not the default module : 因此,如果不是默认模块,请指定自定义控制器所在的模块名称:

$front->addControllerDirectory('/path/to/directory', 'moduleName');

however you can also add it in application.ini file : 但是,您也可以将其添加到application.ini文件中:

application.ini : application.ini:

; resources frontController
resources.frontController.controllerDirectory[] = APPLICATION_PATH "/path/to/directory1"
resources.frontController.controllerDirectory[] = APPLICATION_PATH "/path/to/directory2"

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

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