mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进模板引擎
This commit is contained in:
@@ -15,6 +15,8 @@ use think\Exception;
|
||||
|
||||
class File
|
||||
{
|
||||
protected $cacheFile;
|
||||
|
||||
/**
|
||||
* 写入编译缓存
|
||||
* @param string $cacheFile 缓存的文件名
|
||||
@@ -42,20 +44,13 @@ class File
|
||||
*/
|
||||
public function read($cacheFile, $vars = [])
|
||||
{
|
||||
$this->cacheFile = $cacheFile;
|
||||
if (!empty($vars) && is_array($vars)) {
|
||||
// 模板阵列变量分解成为独立变量
|
||||
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);
|
||||
extract($vars, EXTR_OVERWRITE);
|
||||
}
|
||||
//载入模版缓存文件
|
||||
include $cacheFile;
|
||||
include $this->cacheFile;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user