使用PHP使用simplexml_load()显示所有提要

使用PHP使用simplexml_load()显示所有提要,php,simplexml,Php,Simplexml,我想循环获取所有提要,但只显示一个提要 $url = "http://localhost/feeds/feeds.rss"; $xml = simplexml_load_file($url); foreach($xml->item as $result){ echo $result->description."<br>"; } $url=”http://localhost/feeds/feeds.rss"; $xml=simp

我想循环获取所有提要,但只显示一个提要

$url = "http://localhost/feeds/feeds.rss";

$xml = simplexml_load_file($url); 

    foreach($xml->item as $result){ 

        echo $result->description."<br>";

    }
$url=”http://localhost/feeds/feeds.rss";
$xml=simplexml\u加载文件($url);
foreach($xml->item as$result){
echo$result->description.“
”; }
RSS提要是-

<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>

/
/
/
/
/
/
/
/
/
/
/
/
/
/
/
解决方案是:

foreach($xml->channel->item as $result){ 

        echo $result->description."<br>";

    }
foreach($xml->channel->item as$result){
echo$result->description.“
”; }
您想只显示一个,还是您的问题是只显示一个?你的订阅源看起来像什么?我想显示所有的订阅源,但它只显示一个。RSS看起来像什么?///“atom:link”-这个前缀在哪里与uri关联?你能复制并粘贴整个feed吗?我不知道为什么这被否决了,但是这很好用,很有效