From 70d0de22efcf64d1994756cbdfb257576e73ca4a Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 2 Jan 2020 11:48:20 +0800 Subject: [PATCH] add clear --- common/HttpClient.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/HttpClient.php b/common/HttpClient.php index 6ac7fc8..d16cdab 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -472,7 +472,11 @@ class HttpClient return json_decode($body, true); } else if (strpos($type, 'xml') !== false) { $data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA); - return json_decode(json_encode($data), TRUE); + $encode = json_encode($data); + if (is_array($encode)) { + return $encode; + } + return json_decode($encode, TRUE); } else if (strpos($type, 'plain') !== false) { return json_decode($data, TRUE); } else {