我目前正在开发一个动态RSS源,它将自动从MySQL数据库中提取文章。代码是我应该为动态RSS使用什么文件扩展名
<?php
//Include the post retreival script
require_once '../phpScripts/rss_db_setup.php';
//Set the content type
header('Content-type: text/xml');
//Set up the RSS feed information
echo '<?xml version="1.0" encoding="ISO-8859-1"?>'.
'<rss version="2.0">'.
'<channel>'.
'<title>Company Name</title>'.
'<link>http://www.company.ca</link>'.
'<description></description>'.
'<category></category>';
//Retreive posts from the database
$rssData = new rssData();
echo $rssData->generateFeed($dbcon);
//Close the feed
echo '</channel></rss>';
?>
我想知道这个文件是否应该保存为.xml或.php?我已经添加了下面一行到我的.htaccess文件,但并不真正了解它是如何工作的
AddType application/x-httpd-php .xml
这是做这个正确的方式?或者我应该使用另一个htaccess函数,例如modRewrite,或者每天使用CRON作业生成一个新的.xml文件?
所有文件名都没有意义,它的标题和内容是 – 2011-11-03 20:00:15
'.dynamicrssrenderedviaphp'。我当然是小孩。 +1到@Dagon。 –