用 PHP 做 google Map 程序的教程中有一段。
大概意思是说有些教程让你用PHP写JS来创建Google Map程序,但是这样问题很多。
使用 XML 文件作为连接数据库和Google Map 的中介,将使地图网页初始化更快,可以创建更灵活的地图程序,调试也更方便。你可以单独的验证XML输出。甚至你可以完全忽略数据库只用XML运行你的地图。
上午看了一个开源PHP类phoogle,它是一个PHP创建Google Map 的类,调试中出现一些问题,正如这段文章所说一样。
文章来源:http://code.google.com/support/bin/answer.py?answer=65622
Note: Some tutorials may suggest actually writing your map page as a PHP file and outputting JavaScript for each marker you want to create, but that technique can be problematic. By using an XML file as an intermediary between our database and our Google Map, it makes for a faster initial page load, a more flexible map application, and easier debugging. You can independently verify the XML output from the database and the JavaScript parsing of the XML. And at any point, you could even decide to eliminate your database entirely and just run the map based on static XML files.