0

如何用我设计的页面替换库存异常页面(红色和灰色页面)。

我按照以下步骤

步骤 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 的处理程序方法中给出的值“here”得到显示,但执行从未触及那条线。

我还注意到,为 init(errors) 提供错误值并没有关闭库存异常页面。

4

1 回答 1

0

我正在使用过时的异常处理例程。在 Kohana 3.3 中,必须使用以下链接 http://kohanaframework.org/3.3/guide/kohana/tutorials/error-pages中说明的方法

于 2014-06-24T06:31:25.147 回答