这是我的XML
<?xml version="1.0" encoding="UTF-8"?>
-<RentListings>
-<RentListing>
<Country>UAE</Country>
<State>Dubai</State>
<City>Dubai</City>
<District>Dubailand District</District>
<Comm>Arabian Ranches</Comm>
<SubComm>Al Mahra</SubComm>
<Bedroom>2</Bedroom>
-<Images>
<ImageUrl>http://cdn.example.com/img/1.jpg</ImageUrl>
<ImageUrl>http://cdn.example.com/img/2.jpg</ImageUrl>
<ImageUrl>http://cdn.example.com/img/3.jpg</ImageUrl>
</Images>
<Last_Updated>Jun 1 2014 9:46AM</Last_Updated>
<Unit_Status>Vacant</Unit_Status>
</RentListing>
</RentListings>
这是我的代码,用于从XML中提取详细信息
$XMLrent = new SimpleXMLElement($xml_here);
foreach($XMLrent->RentListing AS $oEntry){
echo $oEntry->City;
**[Images should be place here]**
}
我的问题是我不知道如何检索和循环<Images>
节点
答案 0 :(得分:0)
foreach($oEntry->Images->ImageUrl AS $oImageUrl){
echo $oImageUrl;
}