mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
ViewResponse类增加getVars方法
This commit is contained in:
@@ -38,7 +38,7 @@ class View extends Response
|
||||
|
||||
/**
|
||||
* 视图变量赋值
|
||||
* @access protected
|
||||
* @access public
|
||||
* @param array $vars 模板变量
|
||||
* @return $this
|
||||
*/
|
||||
@@ -48,6 +48,21 @@ class View extends Response
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视图变量
|
||||
* @access public
|
||||
* @param string $name 模板变量
|
||||
* @return mixed
|
||||
*/
|
||||
public function getVars($name = null)
|
||||
{
|
||||
if(is_null($name)){
|
||||
return $this->vars;
|
||||
}else{
|
||||
return isset($this->vars[$name]) ? $this->vars[$name] : null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板变量赋值
|
||||
* @access public
|
||||
|
||||
Reference in New Issue
Block a user