From c0e666819f02949f67e2dd636f5e7214c52df3e3 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 12 May 2017 10:42:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BResponse=E7=B1=BB=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=89=8B=E5=8A=A8=E8=AE=BE=E7=BD=AEcontentType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Response.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/library/think/Response.php b/library/think/Response.php index 1be3c68e..fff782c6 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -19,7 +19,6 @@ use think\response\Xml as XmlResponse; class Response { - // 原始数据 protected $data; @@ -50,12 +49,12 @@ class Response public function __construct($data = '', $code = 200, array $header = [], $options = []) { $this->data($data); - $this->header = $header; - $this->code = $code; if (!empty($options)) { $this->options = array_merge($this->options, $options); } $this->contentType($this->contentType, $this->charset); + $this->header = $header; + $this->code = $code; } /** @@ -197,9 +196,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))); } @@ -309,9 +308,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))); }