php生成rss订阅

代码:

<?php
$host = $_SERVER['HTTP_HOST']; 
$xmls = '<?xml version="1.0" encoding="utf-8"?> 
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" 
xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> <channel>
'; foreach ($news as $keys => $values) { //foreach ($values as $key1 => $value1) { $xmls .= "<item><title>".$values["title"]."</title>"; $xmls .= "<link>http://$host/news.php?id=".$values['id']."</link>"; //$xmls .= "<description><![$value1[description]]></description>"; //$xmls .= "<pubDate>".$values["addtime"]."</pubDate>"; $xmls .= "<dc:creator>$host</dc:creator>"; //$xmls .= "<description>".$values["addtime"]."</description>"; $xmls .= "<category><![CDATA[".$values["content"]."]]></category></item>"; //$xmls .= "</channel>"; //} } $xmls .= "</channel></rss>"; echo $xmls; ?>

来源:http://www.bcty365.com/content-10-3078-1.html

posted @ 2016-03-29 10:24  侠岚之弋痕夕  阅读(236)  评论(0编辑  收藏  举报
Where is the starting point, we don't have a choice, but the destination where we can pursue!