【发布时间】:2018-07-23 10:24:12
【问题描述】:
我似乎无法检索第二个媒体:内容,即上面带有width="460" 的那个。
<item>
<title>...</title>
<link>...</link>
<description>...</description>
<category domain="...">title</category>
<category domain="...">Benjamin Netanyahu</category>
<category domain="...">Judaism</category>
<category domain="...">Religion</category>
<pubDate>Mon, 23 Jul 2018 07:00:27 GMT</pubDate>
<media:content width="140" url="**(i can retrieve this image)**">
<media:credit scheme="urn:ebu">Photograph: Author 1</media:credit>
</media:content>
<media:content width="460" url="**(but i cant retrieve this one)**">
<media:credit scheme="urn:ebu">Photograph: Author 2</media:credit>
</media:content>
<dc:creator>Touma-Sliman</dc:creator>
<dc:date>2018-07-23T07:00:27Z</dc:date>
</item>
这是我当前的代码:
foreach ($xml->channel->item as $key=>$item)
{
$results = (string)$item[0]->children('media', true)->content->attributes()['url'];
}
【问题讨论】: