From f01c5e35d8553a5df1b70e0b4c6f157e5e37e0cb Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Fri, 3 Jan 2020 11:44:31 +0800 Subject: [PATCH] add clear --- common/HttpClient.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/HttpClient.php b/common/HttpClient.php index 0723cbd..b43d72a 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -463,18 +463,17 @@ class HttpClient */ private function resolve($data, $body) { + $type = $data['Content-Type'] ?? $data['content-type']; if (is_array($body)) { return $body; } - $type = $data['Content-Type'] ?? $data['content-type']; if (strpos($type, 'json') !== false) { return json_decode($body, true); } else if (strpos($type, 'xml') !== false || strpos($type, 'plain') !== false) { if (!is_null($newBody = json_decode($body, true))) { return $newBody; } - $data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA); - return json_decode(json_encode($data), TRUE); + return Help::toArray($body); } else if (strpos($type, 'plain') !== false) { return json_decode($body, TRUE); } else {