代码:
<?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; ?>