微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 创建geoRss feed

我是geoRSS的新手.

我们如何编写geoRSS Feed.我有我的lat long值和mysql db中的一些其他字段,我想在geoRSS Feed添加.

感谢致敬,
阿希什

解决方法:

尝试使用此代码输出geoRSS

header("Content-type: text/xml");
    $xml_output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
    $xml_output .= "<RSS version=\"2.0\" 
      xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\" 
      xmlns:dc=\"http://purl.org/dc/elements/1.1/\">";

    $xml_output .= "<channel>";
    $xml_output .= "<title>My GeoRSS</title>
     <description>Description here</description>
     <link>http://url-here.com/</link>
     <dc:publisher>your_name</dc:publisher>
     <pubDate>Wed, 13 Apr 2011 23:56:15 PST</pubDate>
     <item>
       <pubDate>Wed, 13 Apr 2011 23:56:15 PST</pubDate>
       <title>Feed title</title>
       <description>Feed description</description>
       <link>Feed URL</link>
       <geo:lat>Latitude</geo:lat>
       <geo:long>Longitude</geo:long>
     </item>
   </channel>
</RSS>
";

print $xml_output;

替换从数据库获取的相应字段.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐