From add3ed098c4d1aaaa909d6e77f6c32bb2a0d1921 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 29 Sep 2017 17:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=B8=B2=E6=9F=93=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/View.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/think/View.php b/library/think/View.php index 78b28d7f..4c6f5bdb 100644 --- a/library/think/View.php +++ b/library/think/View.php @@ -155,8 +155,13 @@ class View ob_implicit_flush(0); // 渲染输出 - $method = $renderContent ? 'display' : 'fetch'; - $this->engine->$method($template, $vars, $config); + try { + $method = $renderContent ? 'display' : 'fetch'; + $this->engine->$method($template, $vars, $config); + } catch (\Exception $e) { + ob_clean(); + throw $e; + } // 获取并清空缓存 $content = ob_get_clean();