Update Tools.php

This commit is contained in:
Anyon 2020-04-26 11:12:37 +08:00
parent d42e8836f7
commit 90b5b091a2

View File

@ -171,13 +171,12 @@ class Tools
*/
public static function xml3arr($xml)
{
$parser = xml_parser_create();
if (!xml_parse($parser, $xml, true)) {
xml_parser_free($parser);
return false;
}
if (xml_parse($parser = xml_parser_create(), $xml, true)) {
return json_decode(json_encode(simplexml_load_string($xml)), true);
}
if (is_resource($parser)) xml_parser_free($parser);
return false;
}
/**
* 数组转xml内容