Php Zend Framework:如何为所有模块设置默认错误处理程序?

Php Zend Framework:如何为所有模块设置默认错误处理程序?,php,zend-framework,error-handling,Php,Zend Framework,Error Handling,我创建了几个模块。并在application.ini中添加了以下选项: resources.frontController.plugins.ErrorHandler.class = Zend_Controller_Plugin_ErrorHandler resources.frontController.plugins.ErrorHandler.options.module = default resources.frontController.plugins.ErrorHandler.opti

我创建了几个模块。并在application.ini中添加了以下选项:

resources.frontController.plugins.ErrorHandler.class = Zend_Controller_Plugin_ErrorHandler
resources.frontController.plugins.ErrorHandler.options.module = default
resources.frontController.plugins.ErrorHandler.options.controller = error
resources.frontController.plugins.ErrorHandler.options.action = error
在我设置模块之前,一切都正常

我在application.ini中添加了resources.modules[]=''以使模型工作。并为每个模块添加了boostrap

在此之后,默认的错误处理程序将不工作。zend需要模块的错误处理程序。 如果我删除resources.modules[]=“”选项,则它会再次工作


我尝试将选项资源放置在开销选项之后和之前。模块[]='',但结果是相同的。

是否正确设置了模块目录?像这样:

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = 
在引导程序中,您应该具有以下内容:

protected function _initModules()
{
    $front = Zend_Controller_Front::getInstance();
    $front->addModuleDirectory('../application/modules');
}

这些代码使我的全局错误控制器在所有模块中都能正常工作。

为什么要手动注册
Zend\u controller\u Plugin\u ErrorHandler
?它由
Zend\u Controller\u Front
自动注册。因为如果我不手动注册,那么ZF要求每个模块使用errorController。因此,我在应用程序中有几个ErrorController。