如何在php中列出所有国家及其州/省?

发布于 2024-08-04 22:54:48 字数 1459 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

高冷爸爸 2024-08-11 22:54:48

pycountry 是我能找到的最完整的免费参考:

pycountry provides the ISO databases for the standards:

639 Languages
3166 Countries
3166-2 Subdivisions of countries
4217 Currencies
15924 Scripts

The databases are imported from Debian's pkg-isocodes, packaged into pycountry and made accessible through a Python API.

Translation files for the various strings are included as well.

pycountry is the most complete free reference I was ever able to find:

pycountry provides the ISO databases for the standards:

639 Languages
3166 Countries
3166-2 Subdivisions of countries
4217 Currencies
15924 Scripts

The databases are imported from Debian's pkg-isocodes, packaged into pycountry and made accessible through a Python API.

Translation files for the various strings are included as well.
楠木可依 2024-08-11 22:54:48

Geonames 获取数据是一种选择。它保持相对最新状态,并采用 CC 许可证。

Grabbing data from Geonames would be an option. It is kept relatively up to date, and is under a CC license.

风月客 2024-08-11 22:54:48

我没有代码可以做到这一点,但如果您想要世界大部分地区的行政区的良好(免费)列表,您可以使用 维基百科页面。

I don't have code to do it, but if you want a good (free) list of administrative districts for most of the world you can use this Wikipedia page.

悲念泪 2024-08-11 22:54:48

As Squeeks says you can use GeoNames.

I did a tool ( https://github.com/yosoyadri/GeoNames-XML-Builder ) that downloads and saves GeoNames response as a XML file based on the library at http://geonamesdotorgdotnet.codeplex.com/.

You can also download a complete file of countries and states/provinces at https://raw.github.com/yosoyadri/GeoNames-XML-Builder/master/continents-countries-statesprovinces.xml

何以心动 2024-08-11 22:54:48

如果你不想使用 sql,这里只是一个带有地区国家的省/州的 JavaScript,我不久前发现了它。也许它很有用......

http: //www.sitepoint.com/forums/showthread.php?350291-Country-State-City-Dropdown-list

In case you don't want to use sql, here is just a javascript with region country's province/state, i found it a while ago. Maybe its of good use....

http://www.sitepoint.com/forums/showthread.php?350291-Country-State-City-Dropdown-list

像极了他 2024-08-11 22:54:48

这已经是最接近的了。
http://27.org/isocountrylist/

这个列表相当旧,但它确实提供了很多东西对于那些想要包含代码和缩写的国家/地区列表的人来说很有价值。此外,还有与美国各州和省份的链接。多年来,这一直是一个很好的资源。

利用此表数据,某人可以在国家、州、省、县或任何政治管辖区之间创建一些标准化数据。

我认为这将为这项任务节省大量时间。

This is as close as it gets.
http://27.org/isocountrylist/

This list is rather old, however it does offer a great deal of value for those wanting a country list, with codes and abbreviations. Also, there is a link to US States and provinces there too. This has been a good resource over the years.

With this table data, it's possible for someone to create some normalized data between countries, states, provinces, counties or whatever political jurisdictions.

I thought this would be a huge time saver for this task.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文