mirror of
https://gitee.com/zoujingli/WeChatDeveloper.git
synced 2025-04-05 09:52:47 +08:00
Update Tools.php
This commit is contained in:
parent
9416930902
commit
cf2037dbac
@ -159,8 +159,13 @@ class Tools
|
||||
*/
|
||||
public static function xml2arr($xml)
|
||||
{
|
||||
if (PHP_VERSION_ID < 80000) libxml_disable_entity_loader(true);
|
||||
$data = (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
$backup = libxml_disable_entity_loader(true);
|
||||
$data = (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
libxml_disable_entity_loader($backup);
|
||||
} else {
|
||||
$data = (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
return json_decode(json_encode($data), true);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user