Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用SimpleXMLElement在XML内部节点中循环_Php_Xml - Fatal编程技术网

Php 使用SimpleXMLElement在XML内部节点中循环

Php 使用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

<?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;
 }