20,359
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="gbk" ?>
<xml>
<result>1</result>
<total>277</total>
<num>30</num>
<start>0</start>
<xyString>11419415,3059132,11436404,3055803</xyString>
<searchType>round</searchType>
<list>
<I0>
<id>0027_47371</id>
<title>鹏鹏小吃</title>
<atitle>鹏鹏小吃</atitle>
<aaddr ></aaddr>
<addr />
<category>50300</category>
<navigator>快餐厅餐饮相关</navigator>
<tel />
<pic_urlS />
<gc>11427798 3058375</gc>
<bus>1</bus>
<intro />
<aintro />
</I0>
<I1>
<id>0027_164307</id>
<title>健康快餐(江汉桥小学西北)</title>
<atitle>健康快餐(江汉桥小学西北)</atitle>
<aaddr />
<addr />
<category>50300</category>
<navigator>快餐厅餐饮相关</navigator>
<tel />
<pic_urlS />
<gc>11426761 3056654</gc>
<bus>1</bus>
<intro />
<aintro />
</I1>
<I2>
<id>0027_109608</id>
<title>福建蒸饺王大兴路分店</title>
<atitle>福建蒸饺王大兴路分店</atitle>
<aaddr />
<addr />
<category>50300</category>
<navigator>快餐厅餐饮相关</navigator>
<tel />
<pic_urlS />
<gc>11429130 3056882</gc>
<bus>1</bus>
<intro />
<aintro />
</I2>
<I3>
<id>0027_51453</id>
<title>永和大王(江汉路)</title>
<atitle>永和大王(江汉路)</atitle>
<aaddr>江汉步行街</aaddr>
<addr>江汉步行街</addr>
<category>50300</category>
<navigator>快餐厅餐饮相关</navigator>
<tel />
<pic_urlS />
<gc>11429024 3058214</gc>
<bus>1</bus>
<intro />
<aintro />
</I3>
<I4>
<id>0027_109000</id>
<title>李记特色小吃</title>
<atitle>李记特色小吃</atitle>
<aaddr />
<addr />
<category>50300</category>
<navigator>快餐厅餐饮相关</navigator>
<tel />
<pic_urlS />
<gc>11426940 3056838</gc>
<bus>1</bus>
<intro />
<aintro />
</I4>
</list>
</xml>
<?php
$dom = new DOMDocument();
$dom ->load('test.xml');
$xml = $dom ->getElementsByTagName('xml');
foreach ($xml as $xmlVal){
$results = $xmlVal->getElementsByTagName('result');
$result = $results->item(0)->nodeValue;
$totals = $xmlVal->getElementsByTagName('total');
$total = $totals->item(0)->nodeValue;
$lists = $xmlVal->getElementsByTagName('list');
$list = $lists->item(0)->nodeValue;
var_dump( $list);
}
$str='<result>'.$result.'</result>'.'<total>'.$total.'</total>';
echo htmlspecialchars($str);
?>