From 0220bb69b0ae6aa370eac0feffd99928bab761ed Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Fri, 3 Jan 2020 11:39:57 +0800 Subject: [PATCH] add clear --- common/HttpClient.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/HttpClient.php b/common/HttpClient.php index c66ff85..affa627 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -467,6 +467,9 @@ class HttpClient 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); } else if (strpos($type, 'plain') !== false) {