首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建geoRss源

创建geoRss源
EN

Stack Overflow用户
提问于 2011-04-13 14:11:35
回答 1查看 1.8K关注 0票数 3

我是geoRss的新手。

我们如何编写geoRss提要。我在mysql db中有我的lat long值和其他一些字段,我希望将它们添加到geoRss提要中。

谢谢和问候,阿希什

EN

回答 1

Stack Overflow用户

发布于 2011-04-13 14:38:03

尝试使用此代码输出geoRSS

代码语言:javascript
复制
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;

替换从数据库中取出的各个字段。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5645113

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档