问题
I am currently working on a PHP application that puts me in the desperate need of all the Countries, States and Cities in the world.
In the application, when you select a Country from the drop down menu, it loads up all the States in the selected Country into another drop down menu. When you then select a State from the newly generated drop down menu, it then loads up all the cities in the selected State into another drop down menu.
The challenge now is getting all the Countries, States and Cities. I have tried searching Google without results.
Am wondering if there is any PHP library or application that has all Countries, States and cities in it, so i can download and extend.
Thanks very much for your time.
回答1:
A good place to start would be MaxMind PHP library which uses the freely available MaxMind.com database
回答2:
there is GeoDataSource World Cities Database (Gold Edition) March.2010
. This contains:
- city database
- latitude longitude
- city latitude
- cities database
- world cities
- global cities
- world countries
- distance calculator
- state list
- gazetteer
- place names
- populated places
- GPS
and more, there is even a basic and premium package.
** EDIT
May not be worthwhile if your looking for something free however because the free package only offers city names. The basic package is One Month - $149.95 One Year - $449.95
and the packages only get more expensive.
来源:https://stackoverflow.com/questions/2383983/php-library-with-countries-states-and-cities