更新代码,适配php7.4
This commit is contained in:
@@ -395,7 +395,7 @@ class Response
|
||||
if (null == $this->content) {
|
||||
$content = $this->output($this->data);
|
||||
|
||||
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
|
||||
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_bool($content) && !is_array($content) && !is_callable([
|
||||
$content,
|
||||
'__toString',
|
||||
])
|
||||
@@ -403,7 +403,13 @@ class Response
|
||||
throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content)));
|
||||
}
|
||||
|
||||
$this->content = (string) $content;
|
||||
if (is_bool($content)) {
|
||||
$this->content = $content ? 'true' : 'false';
|
||||
} elseif (is_array($content)) {
|
||||
$this->content = json_encode($content);
|
||||
} else {
|
||||
$this->content = (string) $content;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
|
||||
Reference in New Issue
Block a user