Php Zend Framework 1.12特定于模块的引导类。
我的应用程序具有以下目录结构:Php Zend Framework 1.12特定于模块的引导类。,php,zend-framework,Php,Zend Framework,我的应用程序具有以下目录结构: application modules default controllers models views Bootstrap.php test controllers models views Bootstrap.php 以下是模块特定引导文件的代码: //default/bootstrap.php class De
application
modules
default
controllers
models
views
Bootstrap.php
test
controllers
models
views
Bootstrap.php
以下是模块特定引导文件的代码:
//default/bootstrap.php
class Default_Bootstrap extends Zend_Application_Module_Bootstrap
{
protected function _initMessageDefault(){
echo "called default module's bootstrap file";
}
}
//test/bootstrap.php
class Test_Bootstrap extends Zend_Application_Module_Bootstrap
{
protected function _initMessageTest(){
echo "called test module's bootstrap file";
}
}
现在,如果我调用默认控制器,即www.domain.com/index,我可以看到以下输出:
called default module's bootstrap file
called test module's bootstrap file
我的问题是为什么要调用这两个模块的引导文件?当我调用默认模块时,不应该只调用默认模块的boostrap文件吗
这是一个错误还是我做错了什么
提前谢谢你的帮助 这是有意的。引导用于应用程序初始化,所有引导都在每个请求上运行 如果您希望只为当前模块做一些事情,那么您可能需要一个控制器插件。它们也会在每个请求上运行,但是您可以检查其中的当前模块,然后运行一些自定义代码