From 0d85b268e9388f9acf09c9f5b92e3da641026969 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 23 Sep 2016 12:24:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=A8=A1=E6=9D=BF=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E9=A9=B1=E5=8A=A8=E7=9A=84config=E6=96=B9=E6=B3=95=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=8E=B7=E5=8F=96=E9=85=8D=E7=BD=AE=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Template.php | 2 ++ library/think/view/driver/Php.php | 2 ++ library/think/view/driver/Think.php | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/library/think/Template.php b/library/think/Template.php index f22b3297..c82850c3 100644 --- a/library/think/Template.php +++ b/library/think/Template.php @@ -127,6 +127,8 @@ class Template $this->config = array_merge($this->config, $config); } elseif (isset($this->config[$config])) { return $this->config[$config]; + } else { + return null; } } diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index 06f49a6a..31fe7807 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -143,6 +143,8 @@ class Php { if (is_array($name)) { $this->config = array_merge($this->config, $name); + } elseif (is_null($value)) { + return isset($this->config[$name]) ? $this->config[$name] : null; } else { $this->config[$name] = $value; } diff --git a/library/think/view/driver/Think.php b/library/think/view/driver/Think.php index e82f5139..33729b44 100644 --- a/library/think/view/driver/Think.php +++ b/library/think/view/driver/Think.php @@ -130,17 +130,19 @@ class Think } /** - * 配置模板引擎 + * 配置或者获取模板引擎参数 * @access private * @param string|array $name 参数名 * @param mixed $value 参数值 - * @return void + * @return mixed */ public function config($name, $value = null) { if (is_array($name)) { $this->template->config($name); $this->config = array_merge($this->config, $name); + } elseif (is_null($value)) { + return $this->template->config($name); } else { $this->template->$name = $value; $this->config[$name] = $value;