【问题标题】:Target RSS value in PHPPHP 中的目标 RSS 值
【发布时间】:2012-04-19 13:35:33
【问题描述】:

我正在使用 PHP 制作 RSS 提要阅读器,并且我获得了所有提要内容,但我无法确定目标 RSS 值的热点,因此我可以回显它们、设置它们的样式等!

this is the feed

到目前为止我的脚本:

foreach($feed_list as $from => $feeds) {
    $xml = simplexml_load_file($feeds);

    echo "<pre>";
    print_r($xml);
    echo "</pre>";
}

I get this out after code executes

【问题讨论】:

    标签: php rss


    【解决方案1】:

    对不起,我知道怎么做

    <?php
    $rss = simplexml_load_file('http://www.riga.lv/rss/lv/PressRelease/');
    ?>
    <h1><?php echo $rss->channel->title; ?></h1>
    <ul>
    <?php
    foreach($rss->channel->item as $e) {
        echo "<li><a href=\"".$e->link['href']."\">";
        echo $e->title;     
        echo "</a></li>\n";
    }    
    ?>
    

    Thanks to this :) - 感谢堆栈溢出 :)

    【讨论】:

      【解决方案2】:

      您需要遍历返回的$xml 对象并获取每个节点的值...查看http://www.php.net/manual/en/class.simplexmlelement.php 了解更多信息。

      【讨论】:

        猜你喜欢
        • 2017-11-12
        • 2010-09-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多