mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
视图类fetch方法cache参数调整
This commit is contained in:
@@ -42,6 +42,7 @@ class Template
|
|||||||
'taglib_build_in' => 'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序
|
'taglib_build_in' => 'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序
|
||||||
'taglib_pre_load' => '', // 需要额外加载的标签库(须指定标签库名称),多个以逗号分隔
|
'taglib_pre_load' => '', // 需要额外加载的标签库(须指定标签库名称),多个以逗号分隔
|
||||||
'display_cache' => false, // 模板渲染缓存
|
'display_cache' => false, // 模板渲染缓存
|
||||||
|
'cache_id' => '', // 模板缓存ID
|
||||||
'tpl_replace_string' => [],
|
'tpl_replace_string' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -120,13 +120,13 @@ class View
|
|||||||
*
|
*
|
||||||
* @param string $template 模板文件名或者内容
|
* @param string $template 模板文件名或者内容
|
||||||
* @param array $vars 模板输出变量
|
* @param array $vars 模板输出变量
|
||||||
* @param string $cache_id 模板缓存标识
|
* @param array $cache 模板缓存参数
|
||||||
* @param bool $renderContent
|
* @param bool $renderContent
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function fetch($template = '', $vars = [], $cache_id = '', $renderContent = false)
|
public function fetch($template = '', $vars = [], $cache = [], $renderContent = false)
|
||||||
{
|
{
|
||||||
if (!$renderContent) {
|
if (!$renderContent) {
|
||||||
// 获取模板文件名
|
// 获取模板文件名
|
||||||
@@ -142,7 +142,7 @@ class View
|
|||||||
ob_implicit_flush(0);
|
ob_implicit_flush(0);
|
||||||
if ($this->engine) {
|
if ($this->engine) {
|
||||||
// 指定模板引擎
|
// 指定模板引擎
|
||||||
$this->engine->fetch($template, $vars, $cache_id);
|
$this->engine->fetch($template, $vars, $cache);
|
||||||
} else {
|
} else {
|
||||||
// 原生PHP解析
|
// 原生PHP解析
|
||||||
extract($vars, EXTR_OVERWRITE);
|
extract($vars, EXTR_OVERWRITE);
|
||||||
@@ -155,6 +155,7 @@ class View
|
|||||||
$replace = $this->config['parse_str'];
|
$replace = $this->config['parse_str'];
|
||||||
$content = str_replace(array_keys($replace), array_values($replace), $content);
|
$content = str_replace(array_keys($replace), array_values($replace), $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user