如何能够用我设计的异常页(红色和灰色)替换股票异常页。
我遵循以下步骤
步骤1)将System/classes/Kohana/Exception.php复制到Application/classes/Kohana/Exception.php,并添加以下代码片段
class Kohana_Exception extends Kohana_Kohana_Exception {
public static function handler(Exception $e) {
echo 'here'; die;
switch (get_class($e)) {
case 'HTTP_Exception_404':
echo 'here';
$this->HandleException(404, 'errors/404');
return TRUE;
break;
default:
return Kohana_Kohana_Exception::handler($e);
break;
}
}我检查了Application/bootstrap.php并确保了以下代码的存在
Kohana::init(array(
'base_url' => '/web/',
'index_file' => '',
'errors' => true,
'profile' => (Kohana::$environment == Kohana::DEVELOPMENT),
));我只想看到在Kohana_Exception的处理程序方法中显示的“这里”值,但是执行从来没有碰到过这条线。
我还注意到,给init(错误)提供一个假值并不会关闭股票异常页面。
发布于 2014-06-24 06:31:25
我在使用过时的异常处理例程。在Kohana3.3中,必须使用以下链接http://kohanaframework.org/3.3/guide/kohana/tutorials/error-pages中解释的方法
https://stackoverflow.com/questions/24372729
复制相似问题