Home >Backend Development >PHP Tutorial >php将XML转成数组

php将XML转成数组

WBOY
WBOYOriginal
2016-06-23 13:44:14969browse

$xmlstring =

乐杨俊
php将XML转成数组
BJ
乐杨俊php相关浅谈!

XML;


$xml = simplexml_load_string($xmlstring);
$data['info'] = json_decode(json_encode($xml),TRUE);
echo "

";  <br> print_r($data);  <br> foreach($data as $values){  <br> foreach($values as $dv){  <br> echo $dv."\n";  <br> }  <br> } 
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn