开发者

Zend Framework: How to set _one_ default error handler for all modules?

开发者 https://www.devze.com 2023-02-15 09:48 出处:网络
I created several modules. And added follow options in application.ini: resources.frontController.plugins.ErrorHandler.class = Zend_Controller_Plugin_ErrorHandler

I created several modules. And added follow options in 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

Everything was working until I set up modules.

I added resources.modules[] = "" in application.ini to make the model work. And added boostrap for each module.

After that the default error handler doesn't work. And开发者_运维技巧 zend requires the modules' error handler. If I delete the option resources.modules[] = "" then it works again.

I tried to place option resources.modules[] = "" after and befor overhead options, but the result is the same.


Have you set your module directory correctly? Like this:

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = 

And in your bootstrap, you ought to have something like the following:

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

Those pieces of code made my global error controller function correctly, across all modules.

0

精彩评论

暂无评论...
验证码 换一张
取 消