【发布时间】:2014-03-19 10:59:33
【问题描述】:
我在这个脚本中使用 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 始终为空(不是具有空值的数组,而是真正的“空”,即is_null($rsGeoData)===null)。
geoipcity.inc 文件的这个函数返回 Null:
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);
}
我真的不明白为什么……你能帮帮我吗?
【问题讨论】: