我想知道是否可以在用于rss的xml页面中使用Php编码。基本上,我想要连接到mysql数据库,并拉出信息中的rss提要,如图所示;
while($r = mysql_fetch_object($sql_rss)){
$post_title = $r->title;
$post_post = $r->thepost;
$post_link = $r->thelink;
$received_posts .= '
<title>'.$post_title.'</title>
<link>'.$post_link.'</link>
<description>'.$post_post.'</description>';要在xml脚本中使用php,我需要做一些特殊的事情吗?在进阶时谢谢。
发布于 2010-12-19 23:00:08
只需确保服务器正在为PHP指令处理文件(可能是通过在文件名的末尾使用.php ),并设置Content-Type (因为它缺省为HTML)。
header('Content-Type: application/rss+xml');https://stackoverflow.com/questions/4483482
复制相似问题