From 73fdd134829c84680a5e0e37616d68bd2ffc171f Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Wed, 29 Jun 2016 15:10:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=BC=82=E5=B8=B8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 6 ++++++ library/think/exception/Handle.php | 4 +++- tpl/think_exception.tpl | 25 ++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index 99613ac6..9865d1d3 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -349,6 +349,12 @@ class App self::$debug = Config::get('app_debug'); if (!self::$debug) { ini_set('display_errors', 'Off'); + } else { + //重新申请一块比较大的buffer + if (ob_get_level() > 0) { + ob_end_clean(); + } + ob_start(); } // 应用命名空间 diff --git a/library/think/exception/Handle.php b/library/think/exception/Handle.php index 7efe241c..a598df8c 100644 --- a/library/think/exception/Handle.php +++ b/library/think/exception/Handle.php @@ -155,8 +155,10 @@ class Handle while (ob_get_level() > 1) { ob_end_clean(); } + + $data['echo'] = ob_get_clean(); + ob_start(); - ob_implicit_flush(0); extract($data); include Config::get('exception_tmpl'); // 获取并清空缓存 diff --git a/tpl/think_exception.tpl b/tpl/think_exception.tpl index 5fadd7cc..aabf82a8 100644 --- a/tpl/think_exception.tpl +++ b/tpl/think_exception.tpl @@ -123,6 +123,26 @@ .line-error{ background: #f8cbcb; } + + .echo table { + width: 100%; + } + + .echo pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f7f7f7; + border: 0; + border-radius: 3px; + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + } + + .echo pre > pre { + padding: 0; + margin: 0; + } /* Exception Info */ .exception .message{ @@ -130,7 +150,7 @@ border: 1px solid #ddd; border-bottom: 0 none; line-height: 18px; - font-size:16px; + font-size:16px; border-top-left-radius: 4px; border-top-right-radius: 4px; font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑"; @@ -258,6 +278,9 @@
+