Files
framework/library/think/view/driver/Think.php
shuipf 5217692224 Update Think.php
修改Think驱动,增加config方法,支持参数配置和获取
2016-02-20 12:58:48 +08:00

49 lines
1.4 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think\view\driver;
use think\Template;
class Think
{
private $template = null;
public function __construct($config = [])
{
$this->template = new Template($config);
}
public function fetch($template, $data = [], $cache = [])
{
if (is_file($template)) {
$this->template->display($template, $data, $cache);
} else {
$this->template->fetch($template, $data);
}
}
/**
* 修改模板引擎配置项
* @access public
* @param array|string $config
* @return string|array
*/
public function config($config)
{
if(is_array($config)){
$this->template->config($config);
return $this;
}else{
return $this->template->config($config);
}
}
}