mirror of
https://gitee.com/zoujingli/WeChatDeveloper.git
synced 2025-04-06 03:58:03 +08:00
[更新]xml获取安全处理 #11
This commit is contained in:
parent
8a38e24160
commit
39682a047e
@ -143,7 +143,10 @@ class Tools
|
|||||||
*/
|
*/
|
||||||
public static function xml2arr($xml)
|
public static function xml2arr($xml)
|
||||||
{
|
{
|
||||||
return json_decode(self::arr2json(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
|
$entity = libxml_disable_entity_loader(true);
|
||||||
|
$data = (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||||
|
libxml_disable_entity_loader($entity);
|
||||||
|
return json_decode(self::arr2json($data), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user