下面是我的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>节点
发布于 2014-06-02 17:46:23
foreach($oEntry->Images->ImageUrl AS $oImageUrl){
echo $oImageUrl;
}https://stackoverflow.com/questions/23991468
复制相似问题