PHP——SimpleXMLElement——解析im:image

PHP——SimpleXMLElement——解析im:image,php,simplexml,xml-namespaces,Php,Simplexml,Xml Namespaces,如何提取im:图像元素。例如,我可以这样做: $feed=file_get_contents($url); $xml = new SimpleXMLElement($feed); $title = $xml->entry[0]->title; $html = $xml->entry[0]->content; 但我不能得到这个: $img = $xml->entry[0]->im; 我如何瞄准这些目标?我也愿意使用DOMDocument() 编辑: htt

如何提取im:图像元素。例如,我可以这样做:

$feed=file_get_contents($url);
$xml = new SimpleXMLElement($feed);
$title = $xml->entry[0]->title;
$html = $xml->entry[0]->content;
但我不能得到这个:

$img = $xml->entry[0]->im;
我如何瞄准这些目标?我也愿意使用DOMDocument()

编辑:


http://foo.com/foo.jpg

im只是一个名称空间。你想要的是“图像”元素,而不是im–Dmitri Snytkine 20小时前


是的,这是真的,我需要的线索。

您的XML是。。。。rss?im只是一个名称空间。你想要的是“图像”元素,而不是Imtri,这是我需要的线索。
<entry>
  <im:image height="55">
    http://foo.com/foo.jpg
  </im:image>
</entry>