我想循环获取所有Feed,但只显示一个
$url = "http://localhost/feeds/feeds.rss";
$xml = simplexml_load_file($url);
foreach($xml->item as $result){
echo $result->description."<br>";
}
RSS Feed是 -
<channel>
<title>/</title>
<link>/</link>
<atom:link type="application/rss+xml" href="/" rel="self"/>
<description>/</description>
<language>/</language>
<ttl>/</ttl>
<item>
<title>/</title>
<description>/</description>
<pubDate>/</pubDate>
<guid>/</guid>
<link>/</link>
</item>
<item>
<title>/</title>
<description>/</description>
<pubDate>/</pubDate>
<guid>/</guid>
<link>/</link>
</item>
</channel>
答案 0 :(得分:-1)
解决方案是:
foreach($xml->channel->item as $result){
echo $result->description."<br>";
}