diff --git a/library/think/template/driver/File.php b/library/think/template/driver/File.php index bf3d22af..f7fa8c89 100644 --- a/library/think/template/driver/File.php +++ b/library/think/template/driver/File.php @@ -44,7 +44,15 @@ class File { if (!empty($vars) && is_array($vars)) { // 模板阵列变量分解成为独立变量 - extract($vars, EXTR_OVERWRITE); + if (isset($vars['cacheFile'])) { + $_think_cacheFile = $cacheFile; + $cacheFile = $vars['cacheFile']; + unset($vars['cacheFile'], $vars['_think_cacheFile']); + extract($vars, EXTR_OVERWRITE); + include $_think_cacheFile; + return; + } + extract($vars); } //载入模版缓存文件 include $cacheFile; diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index 029ee694..47c9dc10 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -74,6 +74,8 @@ class Php App::$debug && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]', 'info'); if (isset($data['template'])) { $__template__ = $template; + $template = $data['template']; + unset($data['template'], $data['__template__']); extract($data, EXTR_OVERWRITE); include $__template__; } else { @@ -93,6 +95,8 @@ class Php { if (isset($data['content'])) { $__content__ = $content; + $content = $data['content']; + unset($data['content'], $data['__content__']); extract($data, EXTR_OVERWRITE); eval('?>' . $__content__); } else {