2014-06-23 36 views
0

如何用设计的库存异常页面(红色和灰色)替换。Kohana/PHP自定义异常处理在Kohana中不起作用3.3

我遵循以下步骤

步骤1)复制系统/类/ Kohana的/ Exception.php到应用程序/类/ 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; 
     } 
    } 

我检查应用程序/ bootstrap.php中,确保下面的代码存在

Kohana::init(array(
    'base_url' => '/web/', 
     'index_file' => '', 
     'errors' => true, 
     'profile'  => (Kohana::$environment == Kohana::DEVELOPMENT), 

)); 

我只是想看到价值“这里”越来越显示我所内给个e Kohana_Exception的处理程序方法,但执行永远不会触及该行。

我也注意到给init(错误)赋予一个错误的值不会关闭库存异常页面。

回答