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