From 961b7c1bd09e361747dffe826d28d3574fa4a5fb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 8 Sep 2016 17:03:25 +0800 Subject: [PATCH] =?UTF-8?q?View=E7=B1=BB=E5=A2=9E=E5=8A=A0config=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=94=A8=E4=BA=8E=E8=AE=BE=E7=BD=AE=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=BC=95=E6=93=8E=E5=8F=82=E6=95=B0=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=BC=95=E6=93=8E=E9=A9=B1=E5=8A=A8=E5=A2=9E=E5=8A=A0config?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/View.php | 12 ++++++++++++ library/think/view/driver/Php.php | 12 ++++++++++++ library/think/view/driver/Think.php | 16 ++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/library/think/View.php b/library/think/View.php index 65d9f72b..9582e969 100644 --- a/library/think/View.php +++ b/library/think/View.php @@ -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 模板文件名或者内容 diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index 4b85e898..04af6df3 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -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) + { + + } + } diff --git a/library/think/view/driver/Think.php b/library/think/view/driver/Think.php index d7ac5954..f100def1 100644 --- a/library/think/view/driver/Think.php +++ b/library/think/view/driver/Think.php @@ -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);