|
|
楼主 |
发表于 2013-4-4 22:06:58
|
显示全部楼层
yoo 发表于 2013-4-4 21:42 
这个数据库里只有国家的数据,没有城市的数据,是无法查到城市的。 - <?php
- include("geoipcity.inc");
- // uncomment for Shared Memory support
- // geoip_load_shared_mem("/usr/local/share/GeoIP/GeoIPCity.dat");
- // $$gi = geoip_open("/usr/local/share/GeoIP/GeoIPCity.dat",GEOIP_SHARED_MEMORY);
- $$gi = geoip_open("GeoLiteCity.dat",GEOIP_STANDARD);
- $$record = geoip_record_by_addr($$gi,$$ip);
- print $$record->country_code . " " . $$record->country_code3 . " " . $$record->country_name . "\n";
- print $$record->region . " " . $$GEOIP_REGION_NAME[$$record->country_code][$$record->region] . "\n";
- print $$record->city . "\n";
- print $$record->postal_code . "\n";
- print $$record->latitude . "\n";
- print $$record->longitude . "\n";
- print $$record->metro_code . "\n";
- print $$record->area_code . "\n";
- print $$record->continent_code . "\n";
- geoip_close($$gi);
- ?>
复制代码 我现在把数据库放到本地就ok了,但是无法输出城市
这个是专门下载的城市的数据库啊 |
|