改进response助手函数 改进Response类的header方法 支持批量设置

This commit is contained in:
thinkphp
2016-06-07 11:52:23 +08:00
parent 5988f36102
commit ae2824ced1
3 changed files with 12 additions and 10 deletions

View File

@@ -216,13 +216,17 @@ class Response
/**
* 设置响应头
* @access public
* @param string $name 参数名
* @param string|array $name 参数名
* @param string $value 参数值
* @return $this
*/
public function header($name, $value)
public function header($name, $value = null)
{
$this->header[$name] = $value;
if (is_array($name)) {
$this->header = $name;
} else {
$this->header[$name] = $value;
}
return $this;
}