视图配置方法config支持获取某个配置的值

This commit is contained in:
thinkphp
2016-02-20 12:44:02 +08:00
parent 2277add345
commit b9d4c41efa

View File

@@ -81,7 +81,7 @@ class View
* @param string $value 值 * @param string $value 值
* @return View * @return View
*/ */
public function config($config = '', $value = '') public function config($config = '', $value = null)
{ {
if (is_array($config)) { if (is_array($config)) {
foreach ($this->config as $key => $val) { foreach ($this->config as $key => $val) {
@@ -89,6 +89,9 @@ class View
$this->config[$key] = $config[$key]; $this->config[$key] = $config[$key];
} }
} }
} elseif (is_null($value)) {
// 获取配置参数
return $this->config[$config];
} else { } else {
$this->config[$config] = $value; $this->config[$config] = $value;
} }