php – 使chrome显示rss feed(2)

这个问题是对此问题的后续跟进:
get google chrome to view an rss feed

我从这个页面复制了源代码(希望这对网站所有者来说是好的):
http://www.petefreitag.com/rss/.
我从所有引号中逃脱并制作了一个PHP文件.该文件如下所示:

<?PHP

header('Content-Type: application/RSS+xml');

echo "<?xml version=\"1.0\" ?>
<?xml-stylesheet type=\"text/css\" href=\"http://www.petefreitag.com/RSS/simple_style.css\" ?>

<RSS version=\"2.0\">
    <channel>
        <title>Pete Freitag's Homepage</title>
        <link>http://www.petefreitag.com/</link>
        <description>Covering ColdFusion, Java, Web Development, and other topics</description>
        <language>en-us</language>
        <lastBuildDate>Fri, 23 Mar 2012 18:57:00 GMT</lastBuildDate>
        <ttl>45</ttl>

        <item>
REST OF THE SOURCE CODE
</RSS>
";
?>

在这里你可以看到结果:
http://web.student.tuwien.ac.at/~e0250890/rsstest/test.php

但是,在http://www.petefreitag.com/rss/ chrome上将页面视为RSS Feed,在我的示例中,它仅显示代码.

有什么区别,我如何强制chrome以RSS Feed的形式查看页面

解决方法:

尝试将标题更改为application / xml

通过更改标题,这对我有用:

<?PHP 
header('Content-Type: application/xml');
echo file_get_contents('http://web.student.tuwien.ac.at/~e0250890/RSStest/test.PHP');
?>

Mozilla接受一系列标题

text / xml,application / xml,application / RSS xml,application / atom xml

但似乎chrome只接受text / xml或application / xml

不是100%肯定为什么,也许你应该用google; p

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...