View类增加config方法用于设置模板引擎参数 模板引擎驱动增加config接口方法

This commit is contained in:
thinkphp
2016-09-08 17:03:25 +08:00
parent 83ad0ced1b
commit 961b7c1bd0
3 changed files with 40 additions and 0 deletions

View File

@@ -91,6 +91,18 @@ class View
return $this;
}
/**
* 配置模板引擎
* @access private
* @param string|array $name 参数名
* @param mixed $value 参数值
* @return void
*/
public function config($name, $value = null)
{
$this->engine->config($name, $value);
}
/**
* 解析和获取模板内容 用于输出
* @param string $template 模板文件名或者内容

View File

@@ -132,4 +132,16 @@ class Php
return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
}
/**
* 配置模板引擎
* @access private
* @param string|array $name 参数名
* @param mixed $value 参数值
* @return void
*/
public function config($name, $value = null)
{
}
}

View File

@@ -129,6 +129,22 @@ class Think
return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
}
/**
* 配置模板引擎
* @access private
* @param string|array $name 参数名
* @param mixed $value 参数值
* @return void
*/
public function config($name, $value = null)
{
if (is_array($name)) {
$this->template->config($name);
} else {
$this->template->$name = $value;
}
}
public function __call($method, $params)
{
return call_user_func_array([$this->template, $method], $params);