xml转array

1、字串

$xml = simplexml_load_string($data);
$array = json_decode(json_encode($xml),TRUE);

2、文件
$xml = simplexml_load_file($data);
$array= json_decode(json_encode($xml),TRUE);

posted @ 2016-09-05 10:35  loweringye  阅读(133)  评论(0编辑  收藏  举报