PHP到RSS [英] PHP to RSS
本文介绍了PHP到RSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用一些PHP代码创建一个简单的RSS提要,例如显示
远程IP和主机名。
谁可以帮我这个?
提前谢谢,
Robertico
解决方案
您需要设置标题:
<?php
header(" Content-Type:text / xml");
?>
标头必须设置是为了指定你要写的
xml。
当你想打印类似ip的东西时这样做:
< ; ipaddress><?php echo
_SESSION [" IPADDRESS"];?>< / ipaddress>
标题后设置,你逃脱PHP你只需要创建
常规xml标签,并在需要时使用php打印....我希望
帮助
Daniel
这是我用PHP生成RSS 2.0 feed的脚本。
<?php
I''d like to create a simple RSS feed using some PHP code, e.g. displaying
the remote IP and Host name.
Who can help me with this ?
Thanks in advance,
Robertico
解决方案You will need to set the header :
<?php
header("Content-Type: text/xml");
?>
the header has to be set in order to specify that you will be writing
xml.
When you want to print something like the ip do this:
<ipaddress><?php echo
_SESSION["IPADDRESS"];?></ipaddress>
After the header is set and you escape from php you''ll just be creating
regular xml tags and printing using php when you need to....I hope that
helps
Daniel
Here is the script that I used to generate RSS 2.0 feed using PHP.
<?php
这篇关于PHP到RSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文