视图类fetch方法cache参数调整

This commit is contained in:
thinkphp
2015-12-13 21:25:32 +08:00
parent 958d665d3c
commit 9444419dd3
2 changed files with 5 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ class Template
'taglib_build_in' => 'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序
'taglib_pre_load' => '', // 需要额外加载的标签库(须指定标签库名称),多个以逗号分隔
'display_cache' => false, // 模板渲染缓存
'cache_id' => '', // 模板缓存ID
'tpl_replace_string' => [],
];

View File

@@ -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;
}