mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 16:12:49 +08:00
改进模板引擎驱动的config方法 支持获取配置参数值
This commit is contained in:
@@ -127,6 +127,8 @@ class Template
|
|||||||
$this->config = array_merge($this->config, $config);
|
$this->config = array_merge($this->config, $config);
|
||||||
} elseif (isset($this->config[$config])) {
|
} elseif (isset($this->config[$config])) {
|
||||||
return $this->config[$config];
|
return $this->config[$config];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ class Php
|
|||||||
{
|
{
|
||||||
if (is_array($name)) {
|
if (is_array($name)) {
|
||||||
$this->config = array_merge($this->config, $name);
|
$this->config = array_merge($this->config, $name);
|
||||||
|
} elseif (is_null($value)) {
|
||||||
|
return isset($this->config[$name]) ? $this->config[$name] : null;
|
||||||
} else {
|
} else {
|
||||||
$this->config[$name] = $value;
|
$this->config[$name] = $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,17 +130,19 @@ class Think
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置模板引擎
|
* 配置或者获取模板引擎参数
|
||||||
* @access private
|
* @access private
|
||||||
* @param string|array $name 参数名
|
* @param string|array $name 参数名
|
||||||
* @param mixed $value 参数值
|
* @param mixed $value 参数值
|
||||||
* @return void
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function config($name, $value = null)
|
public function config($name, $value = null)
|
||||||
{
|
{
|
||||||
if (is_array($name)) {
|
if (is_array($name)) {
|
||||||
$this->template->config($name);
|
$this->template->config($name);
|
||||||
$this->config = array_merge($this->config, $name);
|
$this->config = array_merge($this->config, $name);
|
||||||
|
} elseif (is_null($value)) {
|
||||||
|
return $this->template->config($name);
|
||||||
} else {
|
} else {
|
||||||
$this->template->$name = $value;
|
$this->template->$name = $value;
|
||||||
$this->config[$name] = $value;
|
$this->config[$name] = $value;
|
||||||
|
|||||||
Reference in New Issue
Block a user