From 145e68074031531f40bc0fa0c0668dd80bfaedc4 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Fri, 3 Jan 2020 11:36:39 +0800 Subject: [PATCH] add clear --- common/HttpClient.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/common/HttpClient.php b/common/HttpClient.php index 7e02338..4a59fe2 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -465,18 +465,11 @@ class HttpClient private function resolve($data, $body) { $type = $data['Content-Type'] ?? $data['content-type']; - if (is_array($body)) { - return $body; - } if (strpos($type, 'json') !== false) { return json_decode($body, true); } else if (strpos($type, 'xml') !== false) { $data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA); - $encode = json_encode($data); - if (is_array($encode)) { - return $encode; - } - return json_decode($encode, TRUE); + return json_decode(json_encode($data), TRUE); } else if (strpos($type, 'plain') !== false) { return json_decode($body, TRUE); } else {