改进Cookie类的get方法支持获取全部 改进Request类的cookie方法

This commit is contained in:
thinkphp
2017-03-23 11:58:52 +08:00
parent 08e0261ad3
commit 1e909984ea
2 changed files with 22 additions and 7 deletions

View File

@@ -802,10 +802,12 @@ class Request
public function cookie($name = '', $default = null, $filter = '')
{
if (empty($this->cookie)) {
$this->cookie = $_COOKIE;
$this->cookie = Cookie::get();
}
if (is_array($name)) {
return $this->cookie = array_merge($this->cookie, $name);
} elseif (!empty($name)) {
$name = Cookie::prefix() . $name;
}
return $this->input($this->cookie, $name, $default, $filter);
}