简体   繁体   English

通过PHP访问tz数据库

[英]Accessing tz database through PHP

I understand that PHP's timezone functionality makes use of the Olson tz database, and I was wondering whether there was a way to access the database information myself more directly, in order to get more accurate information through the use of longitudes and latitudes. 我了解PHP的时区功能利用了Olson tz数据库,我想知道是否有一种方法可以直接自己访问数据库信息,以便通过使用经度和纬度来获取更准确的信息。

I guess, alternatively, if there are any good PHP libraries that can provide me with a timezone when given coordinates, that would be good too. 我猜想,或者,如果有任何好的PHP库可以在给定坐标时为我提供时区,那也很好。 I tried google's api for this, but it is limited and rejected every request I made to it. 我为此尝试了google的api,但它受到限制,并且拒绝了我对此提出的每个请求。

The only coordinates in the tzdb are in zone.tab, and are just a single latitude/longitude for each exemplar city. tzdb中唯一的坐标位于zone.tab中,并且对于每个示例性城市来说只是一个纬度/经度。 That's good for displaying points on a map, but it isn't enough information to let you resolve an arbitrary lat/lon to a time zone. 这对于在地图上显示点很有好处,但信息不足以让您将任意纬度/经度解析为时区。

If you're having issues with Google's apis, you can try to post about those specific issues or contact their support. 如果您在使用Google的api时遇到问题,可以尝试发布有关这些特定问题的信息,或与他们的支持人员联系。 There are other providers as well, or you can build your own geospatial database to resolve them locally. 也有其他提供商,或者您可以构建自己的地理空间数据库以在本地解析它们。

You should also review the community wiki on this subject that I just started. 您还应该查看我刚刚开始的有关此主题的社区Wiki

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM