应用范围:以后的shipping 系统里:
<?xml version="1.0" encoding="UTF-8"?> <humans> <zhangying> <name>张映</name> <sex>男</sex> <old>28</old> </zhangying> <tank> <name>tank</name> <sex>男</sex> <old>28</old> </tank> </humans>
读取方法:
<?PHP $xml_array=simplexml_load_file('http://localhost/test.xml'); //将XML中的数据,读取到数组对象中 foreach($xml_array as $tmp){ echo $tmp->name."-".$tmp->sex."-".$tmp->old."<br>"; } ?> 方法二: <?PHP $reader = new XMLReader(); $reader->open('test.xml'); //读取xml数据 $i=1; while ($reader->read()) { //是否读取 if ($reader->nodeType == XMLReader::TEXT) { //判断node类型 if($i%3){ echo $reader->value; //取得node的值 }else{ echo $reader->value."<br>" ; } $i++; } } ?>原文链接:https://www.f2er.com/xml/300280.html