From 897b565cdb7d8a93afa2925fba346ab7af17d1e1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 25 Dec 2017 12:06:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=A8=A1=E6=9D=BF=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/View.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/library/think/View.php b/library/think/View.php index 54709821..61458667 100644 --- a/library/think/View.php +++ b/library/think/View.php @@ -157,6 +157,9 @@ class View // 渲染输出 try { $method = $renderContent ? 'display' : 'fetch'; + // 允许用户自定义模板的字符串替换 + $replace = array_merge($this->replace, $replace, $this->engine->config('tpl_replace_string')); + $this->engine->config('tpl_replace_string', $replace); $this->engine->$method($template, $vars, $config); } catch (\Exception $e) { ob_end_clean(); @@ -167,11 +170,6 @@ class View $content = ob_get_clean(); // 内容过滤标签 Hook::listen('view_filter', $content); - // 允许用户自定义模板的字符串替换 - $replace = array_merge($this->replace, $replace); - if (!empty($replace)) { - $content = strtr($content, $replace); - } return $content; }