mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
改进模板替换
This commit is contained in:
@@ -157,6 +157,9 @@ class View
|
|||||||
// 渲染输出
|
// 渲染输出
|
||||||
try {
|
try {
|
||||||
$method = $renderContent ? 'display' : 'fetch';
|
$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);
|
$this->engine->$method($template, $vars, $config);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
@@ -167,11 +170,6 @@ class View
|
|||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
// 内容过滤标签
|
// 内容过滤标签
|
||||||
Hook::listen('view_filter', $content);
|
Hook::listen('view_filter', $content);
|
||||||
// 允许用户自定义模板的字符串替换
|
|
||||||
$replace = array_merge($this->replace, $replace);
|
|
||||||
if (!empty($replace)) {
|
|
||||||
$content = strtr($content, $replace);
|
|
||||||
}
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user