- http://www.china-lz.org/
- http://www.china-lz.org/
- http://www.china-lz.org/
- http://www.china-lz.org/
我想取
- http://www.china-lz.org/
放到数组里,我用$xml = simplexml_load_file('file.xml'),foreach $xml->pic 取不出来。
------解决方案--------------------
DOM解法:
- PHP code
$doc = new DomDocument();
$doc->load("file.xml");
$lists=$doc->getElementsByTagName("list");
foreach($lists as $list){
$path=$list->getAttribute("path");
$smallinfo=$list->getAttribute("smallinfo");
$arr[]=array('path'=>$path,'smallinfo'=>$smallinfo,'url'=>$list->nodeValue);
}
print_r($arr);