php生成rss订阅
$host = $_server['http_host'];
$xmls = '<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:trackback="https://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="https://wellformedweb.org/commentapi/" xmlns:slash="https://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>https://$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;