更新默认模板引擎驱动注释
This commit is contained in:
parent
a15a6af6d8
commit
1dd547d04f
|
@ -9,18 +9,38 @@ use top\library\template\ifs\TemplateIfs;
|
||||||
class Top implements TemplateIfs
|
class Top implements TemplateIfs
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var null 当前实例
|
||||||
|
*/
|
||||||
private static $instance = null;
|
private static $instance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var null 模板引擎实现
|
||||||
|
*/
|
||||||
private $engine = null;
|
private $engine = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var null 模板配置
|
||||||
|
*/
|
||||||
private $config = null;
|
private $config = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool 缓存状态
|
||||||
|
*/
|
||||||
private $cache = false;
|
private $cache = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造方法
|
||||||
|
* Top constructor.
|
||||||
|
*/
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部获取当前类实例
|
||||||
|
* @return null|Top
|
||||||
|
*/
|
||||||
public static function instance()
|
public static function instance()
|
||||||
{
|
{
|
||||||
if (!self::$instance) {
|
if (!self::$instance) {
|
||||||
|
@ -36,6 +56,11 @@ class Top implements TemplateIfs
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编译文件
|
||||||
|
* @param $filename
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function compile($filename)
|
private function compile($filename)
|
||||||
{
|
{
|
||||||
$compileFileName = $this->config['compileDir'] . md5($filename) . '.php';
|
$compileFileName = $this->config['compileDir'] . md5($filename) . '.php';
|
||||||
|
@ -51,11 +76,21 @@ class Top implements TemplateIfs
|
||||||
return $compileFileName;
|
return $compileFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $status
|
||||||
|
*/
|
||||||
public function cache($status)
|
public function cache($status)
|
||||||
{
|
{
|
||||||
$this->cache = $status;
|
$this->cache = $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存文件
|
||||||
|
* @param $filename
|
||||||
|
* @param $params
|
||||||
|
* @return string
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
private function cacheFile($filename, $params)
|
private function cacheFile($filename, $params)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -78,6 +113,14 @@ class Top implements TemplateIfs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染文件并返回内容
|
||||||
|
* @param $file
|
||||||
|
* @param $params
|
||||||
|
* @param $cache
|
||||||
|
* @return bool|false|mixed|string
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public function fetch($file, $params, $cache)
|
public function fetch($file, $params, $cache)
|
||||||
{
|
{
|
||||||
$filename = $this->config['dir'] . $file . '.' . $this->config['ext'];
|
$filename = $this->config['dir'] . $file . '.' . $this->config['ext'];
|
||||||
|
|
Loading…
Reference in New Issue