最近为了能使用户直接订阅我们博客的文章,写了一个xml的文件。
<pre lang=”xml” line =”1″>
<?xml version=”1.0″ encoding=”UTF-8″?>
<rss version=”2.0″ xmlns:content=”http://purl.org/rss/1.0/modules/content/” xmlns:wfw=”http://wellformedweb.org/CommentAPI/” xmlns:dc=”http://purl.org/dc/elements/1.1/” xmlns:atom=”http://www.w3.org/2005/Atom” xmlns:sy=”http://purl.org/rss/1.0/modules/syndication/” xmlns:slash=”http://purl.org/rss/1.0/modules/slash/” >
<channel>
<title>精选seo-seo学习</title>
<link>http://www.jxuan.com</link>
<description>seo网站优化,seo网络营销,网站优化,精挑细选,从这里开始!</description>
<lastBuildDate>Sat, 17 Oct 2009 01:01:07 +0000</lastBuildDate>
<generator>http://wordpress.org/?v=2.8.4</generator>
<language>zh-cn</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<!– 博客文章条目循环 –>
<item>
<title>帖子标题。</title>
<link>帖子的链接地址/</link>
<comments>链接地址的详细页#comments</comments>
<pubDate>最新更新时间</pubDate>
<author><![CDATA[作者]]></author>
<category><![CDATA[帖子类型]]></category>
<guid >全球唯一标识<可以写帖子链接地址>/</guid>
<description><![CDATA[帖子内容]]></description>
</item>
<!– 博客文章条目循环 END –>
</channel>
</rss>
</pre>
XML标签说明:
*<webSite>——站点地址。
*<updatetime>——该 xml 文件最近一次的更新时间 。
*<version>——论坛所使用程序的版本。
*<item>——标记每个帖子信息的开始和结束,标记内为单个帖子信息。
*<link>——帖子的 url 地址,即帖子第一页的地址,请尽量去除url中不必要的参数。
<title>——帖子标题。
<pubDate>——帖子主贴的发布时间
<language>——使用语言
<description>——网站描述
上面输出的是一个xml订阅文件 ,可以在头部加
<pre lang=”php” line =”1″>
header(“Content-Type:text/xml”);
</pre>
确定文件是一个符合标准的 xml 文件
这样你就可以输博客的订阅信息了