模板渲染异常处理

This commit is contained in:
thinkphp
2017-09-29 17:22:29 +08:00
parent 5a7b9d1b21
commit add3ed098c

View File

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