From 9444419dd30f7edeede7f00dec4d7e1964e7ffdb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 13 Dec 2015 21:25:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E5=9B=BE=E7=B1=BBfetch=E6=96=B9?= =?UTF-8?q?=E6=B3=95cache=E5=8F=82=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/template.php | 1 + library/think/view.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/think/template.php b/library/think/template.php index 7a5afa64..61c70970 100644 --- a/library/think/template.php +++ b/library/think/template.php @@ -42,6 +42,7 @@ class Template 'taglib_build_in' => 'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序 'taglib_pre_load' => '', // 需要额外加载的标签库(须指定标签库名称),多个以逗号分隔 'display_cache' => false, // 模板渲染缓存 + 'cache_id' => '', // 模板缓存ID 'tpl_replace_string' => [], ]; diff --git a/library/think/view.php b/library/think/view.php index b88600b4..6a9c9876 100644 --- a/library/think/view.php +++ b/library/think/view.php @@ -120,13 +120,13 @@ class View * * @param string $template 模板文件名或者内容 * @param array $vars 模板输出变量 - * @param string $cache_id 模板缓存标识 + * @param array $cache 模板缓存参数 * @param bool $renderContent * * @return string * @throws Exception */ - public function fetch($template = '', $vars = [], $cache_id = '', $renderContent = false) + public function fetch($template = '', $vars = [], $cache = [], $renderContent = false) { if (!$renderContent) { // 获取模板文件名 @@ -142,7 +142,7 @@ class View ob_implicit_flush(0); if ($this->engine) { // 指定模板引擎 - $this->engine->fetch($template, $vars, $cache_id); + $this->engine->fetch($template, $vars, $cache); } else { // 原生PHP解析 extract($vars, EXTR_OVERWRITE); @@ -155,6 +155,7 @@ class View $replace = $this->config['parse_str']; $content = str_replace(array_keys($replace), array_values($replace), $content); } + return $content; }