通过谷歌浏览器查看RSS源 [英] get google chrome to view an rss feed
问题描述
我有一个.php脚本,可以动态生成RSS-Feed。
我想将.css样式表链接到此脚本中,以启用不支持的浏览器有一个内置的RSS-viewer来显示这个提要。我用
echo<?xml version = \1.0 \encoding = \utf- 8 \?> \r\\\
;
echo<?xml-stylesheet type = \text / css\href = \rss.css \?>> \r\\\
;
作为.php文件的第一个输出命令。
然而,像Chrome这样的浏览器仍然不会显示饲料作为网页 - 而是chrome显示我这个页面的代码。
在本教程中,我知道这是可能的...
http://www.petefreitag.com/item/208.cfm
http://www.petefreitag.com/rss/
如何做到这一点?
您应该添加标头
调用来指定内容类型,如下所示:
header(Content-Type:application / rss + xml);
http://www.ibm.com/developerworks/library/x-phprss/ 获取更多信息。
I have an .php script that generates an RSS-Feed dynamically.
I want to link a .css stylesheet to this script to enable browsers that don't have a builtin RSS-viewer to display this feed. I do this with
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n";
echo "<?xml-stylesheet type=\"text/css\" href=\"rss.css\" ?>\r\n";
as the first output commands of the .php-file.
However, browsers like chrome still don't display the feed as webpage - instead chrome shows me the code of this page.
From this tutorial, I know this is somehow possible...
http://www.petefreitag.com/item/208.cfm
http://www.petefreitag.com/rss/
how can this be done?
You should add the header
call to specify content type, like this:
header("Content-Type: application/rss+xml");
http://www.ibm.com/developerworks/library/x-phprss/ for more information.
这篇关于通过谷歌浏览器查看RSS源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!