Php 使用SimpleXMLElement在XML内部节点中循环
这是我的XMLPhp 使用SimpleXMLElement在XML内部节点中循环,php,xml,Php,Xml,这是我的XML <?xml version="1.0" encoding="UTF-8"?> -<RentListings> -<RentListing> <Country>UAE</Country> <State>Dubai</State> <City>Dubai</City> <District>Dub
<?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>
我的问题是我不知道如何检索和循环
节点它对我不起作用这一个对每个($oEntry->Images->ImageUrl AS$ImageUrl){echo$ImageUrl;}稍微解释一下simplexmlement
有一个流动的接口,允许轻松地遍历子元素这一事实会很好。每个($oEntry->Images->ImageUrl作为$ImageUrl)的问题都已解决{echo$ImageUrl;}
foreach($oEntry->Images->ImageUrl AS $oImageUrl){
echo $oImageUrl;
}
foreach($oEntry->Images->ImageUrl AS $oImageUrl){
echo $oImageUrl;
}