From 882c3bff5a0e95bc5e8d594204e32110e5e2d488 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Mon, 16 May 2016 17:06:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=BC=82=E5=B8=B8=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/exception/Handle.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/think/exception/Handle.php b/library/think/exception/Handle.php index 371d8239..a319f9c8 100644 --- a/library/think/exception/Handle.php +++ b/library/think/exception/Handle.php @@ -144,7 +144,14 @@ class Handle // 不显示详细错误信息 $data['message'] = Config::get('error_message'); } - $response = Response::create('html')->render(true)->data(Config::get('exception_tmpl'))->vars($data); + ob_start(); + ob_implicit_flush(0); + extract($data); + include Config::get('exception_tmpl'); + // 获取并清空缓存 + $content = ob_get_clean(); + + $response = Response::create('html')->data($content); if ($exception instanceof HttpException) { $statusCode = $exception->getStatusCode();