热搜:NVER node 开发 php

php将XML转成数组

2024-08-16 16:00:01
php将XML转成数组

$xmlstring = <?xml version="1.0" encoding="utf-8" ?>

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

XML;


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

";  
print_r($data);
foreach($data as $values){
foreach($values as $dv){
echo $dv."\n";
}
}