【发布时间】:2011-07-19 04:02:09
【问题描述】:
这是this question的后续问题,并不重要。
我写了以下前端控制器插件:
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
$response = $this->getResponse();
$monitor = Zend_Registry::get('monitor');
if ($response->isException())
{
$monitor->log($response);
}
}
其中 $monitor 是自定义 DB 日志记录类的一个实例(扩展 Zend_Log)。
在 Monitor 的 log 方法中,我遍历 $response->getException() 返回的 Zend_Exceptions 数组。
出于测试目的,我通过一个动作中的异常:
throw new Zend_Exception('the big test', 555);
大多数事情都按预期工作,异常被写入数据库。
问题
但是,它写了两次。为什么?
【问题讨论】:
标签: php zend-framework exception-handling zend-controller-plugin