我在这个脚本中使用MaxMind GeoIP:
$gi = geoip_open(RESSOURCE_PATH.'/MaxMind/tests/data/GeoIPCity.dat', GEOIP_STANDARD);
// $rsGeoData = GeoIP_record_by_addr($gi, $_SERVER['REMOTE_ADDR']);
$rsGeoData = GeoIP_record_by_addr($gi, '91.213.180.118');
echo("<pre>");
print_r($rsGeoData);
echo("</pre>");
geoip_close($gi);
但$ rsGeoData始终为null(不是具有空值的数组,但实际上是&#34; null&#34;,即is_null($rsGeoData)===null
)。
Null由geoipcity.inc
文件的此函数返回:
function _get_record($gi, $ipnum)
{
$seek_country = _geoip_seek_country($gi, $ipnum);
if ($seek_country == $gi->databaseSegments) {
return null;
}
return _common_get_record($gi, $seek_country);
}
我真的无法理解为什么......你能帮助我吗?