php生成RSS订阅的方法(2)

<?php
header('Content-Type:text/html; charset=utf-8');
$db=mysql_connect('127.0.0.1','root','123456');
mysql_query("set names utf8");
mysql_select_db('dbname',$db);
$brs=mysql_query('select * from article order by add_time desc limit 0,10',$db);
$rss=new UniversalFeedCreator();
$rss->title="页面标题";
$rss->link="网址";
$rss->description="rss标题";
while($rowbrs=mysql_fetch_array($brs)){
    $item=new FeedItem();
    $item->title =$rowbrs['subject'];
    $item->link='https://www.jb51.net/';
    $item->description =$rowbrs['description'];
    $rss->addItem($item);
}
mysql_close($db);
$rss->saveFeed("RSS2.0","rss.xml");

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/bc0bd578ef6b4a119086bfbc2562d7ef.html