From 3cf65dd413771fa671d2502ee597fba4c8f91851 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 8 Dec 2015 18:28:39 +0800 Subject: [PATCH] =?UTF-8?q?view=E7=B1=BB=E5=A2=9E=E5=8A=A0show=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/controller.php | 2 +- library/think/view.php | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/library/think/controller.php b/library/think/controller.php index 98853d33..f1d80cd4 100644 --- a/library/think/controller.php +++ b/library/think/controller.php @@ -114,7 +114,7 @@ class Controller */ public function show($content, $vars = []) { - return $this->view->fetch($content, $vars, '', true); + return $this->view->show($content, $vars); } /** diff --git a/library/think/view.php b/library/think/view.php index 48644b50..84c71e47 100644 --- a/library/think/view.php +++ b/library/think/view.php @@ -58,10 +58,11 @@ class View /** * 设置视图参数 * @access public - * @param array $config 视图参数 + * @param mixed $config 视图参数或者数组 + * @param string $value 值 * @return View */ - public function config(array $config = []) + public function config($config = '',$value='') { if (is_array($config)) { foreach ($this->config as $key => $val) { @@ -69,8 +70,10 @@ class View $this->config[$key] = $config[$key]; } } - return $this; + }else{ + $this->config[$config] = $value; } + return $this; } /** @@ -148,6 +151,18 @@ class View return ob_get_clean(); } + /** + * 渲染内容输出 + * @access public + * @param string $content 内容 + * @param array $vars 模板输出变量 + * @return mixed + */ + public function show($content, $vars = []) + { + return $this->fetch($content, $vars, '', true); + } + /** * 自动定位模板文件 * @access private