From 628b37aab16c496edb3c93d0cf040159f215c086 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Mon, 17 Apr 2017 19:03:01 +0800 Subject: [PATCH] =?UTF-8?q?response=20=E7=9A=84=20header=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20=E6=94=AF=E6=8C=81=E5=80=BC=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Response.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/library/think/Response.php b/library/think/Response.php index d0345782..1be3c68e 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -113,7 +113,11 @@ class Response http_response_code($this->code); // 发送头部信息 foreach ($this->header as $name => $val) { - header($name . ':' . $val); + if (is_null($val)) { + header($name); + } else { + header($name . ':' . $val); + } } } @@ -193,9 +197,9 @@ class Response public function content($content) { if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([ - $content, - '__toString', - ]) + $content, + '__toString', + ]) ) { throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content))); } @@ -305,9 +309,9 @@ class Response $content = $this->output($this->data); if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([ - $content, - '__toString', - ]) + $content, + '__toString', + ]) ) { throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content))); }