<?php
header("Content-type:application/xml");//表示本段代码是一个xml文件,非常重要
$xmlstr = '<rss version="2.0" encoding="utf-8">
<channel>
<title>Personal News Site</title>
<description>daily news from me</description>
<link>http://mydomain.net/</link>
<lastBuildDate>Sat, 19 Jun 2010 08:55:01 GMT</lastBuildDate>
<generator>FeedCreator 1.8.0-dev (info@mypapit.net)</generator>
<copyright>feedcreator (c) 2006</copyright>
<category>Entertainment</category>
<item>
<title>测试成功</title>
<link>http://mydomain.net/news/somelinks.html</link>
<description><![CDATA[<p><strong>hahaha aku berjaya!</strong></p>]]></description>
<author> JohnDoe@example.com (John Doe)</author>
<category>normal</category>
<guid isPermaLink="false">http://mydomain.net/news/somelinks.html</guid>
<guid isPermaLink="false">urn:feeds-archive-org:validator:1</guid>
<enclosure url="http://mydomain.net/news/picture.jpg" length="65905" type="image/jpeg"/>
</item>
<item>
<title>test berita pertama</title>
<link>http://mydomain.net/news/somelinks.html</link>
<description><![CDATA[<p><strong>hahaha aku berjaya!</strong></p>]]></description>
<author> JohnDoe@example.com (John Doe)</author>
<category>normal</category>
<guid isPermaLink="false">http://mydomain.net/news/somelinks.html</guid>
<guid isPermaLink="false">urn:feeds-archive-org:validator:1</guid>
<enclosure url="http://mydomain.net/news/picture.jpg" length="65905" type="image/jpeg"/>
</item>
<item>
<title>test berita pertama</title>
<link>http://mydomain.net/news/somelinks.html</link>
<description><![CDATA[<p><strong>hahaha aku berjaya!</strong></p>]]></description>
<author> JohnDoe@example.com (John Doe)</author>
<category>normal</category>
<guid isPermaLink="false">http://mydomain.net/news/somelinks.html</guid>
<guid isPermaLink="false">urn:feeds-archive-org:validator:1</guid>
<enclosure url="http://mydomain.net/news/picture.jpg" length="65905" type="image/jpeg"/>
</item>
<item>
<title>test berita pertama</title>
<link>http://mydomain.net/news/somelinks.html</link>
<description><![CDATA[<p><strong>hahaha aku berjaya!</strong></p>]]></description>
<author> JohnDoe@example.com (John Doe)</author>
<category>normal</category>
<guid isPermaLink="false">http://mydomain.net/news/somelinks.html</guid>
<guid isPermaLink="false">urn:feeds-archive-org:validator:1</guid>
<enclosure url="http://mydomain.net/news/picture.jpg" length="65905" type="image/jpeg"/>
</item>
<item>
<title>test berita pertama</title>
<link>http://mydomain.net/news/somelinks.html</link>
<description><![CDATA[<p><strong>hahaha aku berjaya!</strong></p>]]></description>
<author> JohnDoe@example.com (John Doe)</author>
<category>test</category>
<guid isPermaLink="false">http://mydomain.net/news/somelinks.html</guid>
<guid isPermaLink="false">urn:feeds-archive-org:validator:1</guid>
<enclosure url="http://mydomain.net/news/picture.jpg" length="65905" type="image/jpeg"/>
</item>
</channel>
</rss>';
echo $xmlstr;
注释:文件一定要是UTF8类型;否则中文会出错;
教你实现RSS订阅功能
最新推荐文章于 2023-08-18 09:38:24 发布