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();