PHP 原生代码生成 RSS 文档
时间:2008-08-27
来源:互联网
<?php
//for PHP 4.x/5.x/6.x
header("Content-Type:text/xml; charset=gb2312");
echo "<?xml version=\"1.0\" encoding=\"gb2312\"?>\n";
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";
echo "<title><![CDATA[“十万个为什么”电脑学习网-办公自动化频道]]></title>\n";
echo "<description><![CDATA[http://why100000.com]]></description>\n";
echo "<link>http://why100000.com/</link>\n";
echo "<language>zh-cn</language>\n";
echo "<docs>WHY100000.COM Document Center</docs>\n";
echo "<generator>Rss Generator ByWWW.WHY100000.COM</generator>\n";
$title = "PPS 有图像没声音的四个解决方法";
$link = "http://www.why100000.com/show_answer.asp?autoid=1046&Path=_oa";
$description = "PPS 有图像没声音的四个解决方法:今天打开PPS,发现只有图像却听不到声音,其他的程序声音都是正常的,说明是PPS的问题了,那么怎么样解决这…\n";
$author = "why100000.com";
$pubDate = "2008-4-20 18:22:28";
create_item($title, $link, $description, $author, $pubDate);
echo "</channel></rss>\n";
function create_item($title_data, $link_data, $description_data, $author_data, $pubDate_data)
{
echo "<item>\n";
echo "<title><![CDATA[$title_data]]></title>\n";
echo "<link><![CDATA[$link_data]]></link>\n";
echo "<description><![CDATA[$description_data]]></description>\n";
echo "<author><![CDATA[$author_data]]></author>\n";
echo "<pubDate><![CDATA[$pubDate_data]]></pubDate>\n";
echo "</item>\n";
}
?>
//for PHP 4.x/5.x/6.x
header("Content-Type:text/xml; charset=gb2312");
echo "<?xml version=\"1.0\" encoding=\"gb2312\"?>\n";
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";
echo "<title><![CDATA[“十万个为什么”电脑学习网-办公自动化频道]]></title>\n";
echo "<description><![CDATA[http://why100000.com]]></description>\n";
echo "<link>http://why100000.com/</link>\n";
echo "<language>zh-cn</language>\n";
echo "<docs>WHY100000.COM Document Center</docs>\n";
echo "<generator>Rss Generator ByWWW.WHY100000.COM</generator>\n";
$title = "PPS 有图像没声音的四个解决方法";
$link = "http://www.why100000.com/show_answer.asp?autoid=1046&Path=_oa";
$description = "PPS 有图像没声音的四个解决方法:今天打开PPS,发现只有图像却听不到声音,其他的程序声音都是正常的,说明是PPS的问题了,那么怎么样解决这…\n";
$author = "why100000.com";
$pubDate = "2008-4-20 18:22:28";
create_item($title, $link, $description, $author, $pubDate);
echo "</channel></rss>\n";
function create_item($title_data, $link_data, $description_data, $author_data, $pubDate_data)
{
echo "<item>\n";
echo "<title><![CDATA[$title_data]]></title>\n";
echo "<link><![CDATA[$link_data]]></link>\n";
echo "<description><![CDATA[$description_data]]></description>\n";
echo "<author><![CDATA[$author_data]]></author>\n";
echo "<pubDate><![CDATA[$pubDate_data]]></pubDate>\n";
echo "</item>\n";
}
?>
作者: 西安PHPer 发布时间: 2008-08-27
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28