dongzaheng4449 2010-01-10 14:54
浏览 164
已采纳

输出RSS feed为html?

Are there any free php/javascript libraries out there which would help in displaying an RSS feed as html?

  • 写回答

4条回答 默认 最新

  • dsvyc66464 2010-01-10 15:03
    关注

    In my Opinion Simplepie is one of the Best RSS parsers.

    Here is an example:

    require_once('simplepie.inc');
    $feed = new SimplePie();
    $feed->set_feed_url('http://simplepie.org/blog/feed/');
    $feed->init();
    $feed->handle_content_type();
    
    
        <?php foreach ($feed->get_items(0, 5) as $item): ?>
    
            <div class="item">
                <h2 class="title"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
                <?php echo $item->get_description(); ?>
                <p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
            </div>
    
        <?php endforeach; ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据