add clear

This commit is contained in:
as2252258@163.com
2020-01-03 11:48:51 +08:00
parent 089f52c585
commit f52d8ff4a8
+4 -1
View File
@@ -32,6 +32,9 @@ class Help extends Miniprogarampage
*/ */
public static function toArray($xml) public static function toArray($xml)
{ {
if (is_array($xml)) {
return $xml;
}
if (!is_null($json = json_decode($xml, TRUE))) { if (!is_null($json = json_decode($xml, TRUE))) {
return $json; return $json;
} }
@@ -39,7 +42,7 @@ class Help extends Miniprogarampage
return $json; return $json;
} }
$data = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); $data = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
if(is_array($data)){ if (is_array($data)) {
return $data; return $data;
} }
return json_decode(json_encode($data), TRUE); return json_decode(json_encode($data), TRUE);