2014-09-24 94 views
1

我有一个这样的对象:访问PHP SimpleXMLElement对象

SimpleXMLElement Object 
(
    [@attributes] => Array 
     (
      [url] => http://openclipart.org/people/jgm104/Expression_of_Emotions.svg 
      [type] => image/svg+xml 
      [length] => 485314 
     ) 

) 

我怎样才能存取权限的URL从那里?

我试过$photos->item[$i]->enclosure->{"@attributes]"} 但它只显示空白的SimpleXMLElement对象。

回答

0

您可以查看在它这样的方式:

$photos->item[$i]->enclosure->attributes()["attributeName"]; 

$miAttrList = $photos->item[$i]->enclosure->attributes(); 
echo $miAttrList["attributeName"];