Created
September 7, 2017 01:11
-
-
Save liuxd/6dff76e3a266eb41d9897b50b2941878 to your computer and use it in GitHub Desktop.
xml2arr.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * xml字符串转成数组。 | |
| * | |
| * @param string $xml | |
| * @return array | |
| */ | |
| function xml2arr ($xml) | |
| { | |
| libxml_disable_entity_loader(true); | |
| return (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment