当我在Action Helper中抛出一个异常(例如throw new Zend_Exception('You are not allowed',403);
)时,ErrorHandler将无法捕捉它。我得到了Fatal error: Uncaught exception 'Zend_Exception' with message 'You are not allowed' in..
。如何在动作助手中捕捉异常?
我也在frontController中设置了throwExceptions = false。
如何在Action Controller中捕获异常?
将throwExceptions设置为false意味着Zend Framework本身不会抛出异常。您的代码特别抛出的异常不会受到影响。 – 2011-06-12 19:16:08
你是否抛出异常来表示这是一个HTTP状态403禁止的整个请求? – hakre 2011-06-12 19:20:23