view类增加show方法

This commit is contained in:
thinkphp
2015-12-08 18:28:39 +08:00
parent e153f7f074
commit 3cf65dd413
2 changed files with 19 additions and 4 deletions

View File

@@ -114,7 +114,7 @@ class Controller
*/
public function show($content, $vars = [])
{
return $this->view->fetch($content, $vars, '', true);
return $this->view->show($content, $vars);
}
/**

View File

@@ -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