将RSS feed输出为html? [英] Output RSS feed as html?
本文介绍了将RSS feed输出为html?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有免费的php/javascript库,可以将RSS供稿显示为html?
Are there any free php/javascript libraries out there which would help in displaying an RSS feed as html?
推荐答案
在我看来 Simplepie 是最好的RSS之一解析器.
In my Opinion Simplepie is one of the Best RSS parsers.
以下是示例:
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; ?>
这篇关于将RSS feed输出为html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文