我试过这个教程http://tech.cibul.net/install-maxminds-geoip-ip-database-on-ubuntu-for-php/并从中做了一切。在我的 Ubuntu 11.10 安装中编译了 geoip 模块和 php 扩展。
我也试过这个更简单的终端命令
(sudo) apt-get install php5-geoip
它显示安装成功但是当我尝试时
geoip_record_by_name('127.0.0.1')
它仍然没有给出任何东西,即根本没有数组。
最佳答案
尝试不同的 IP 地址 - 例如 111.111.111.111
当您检查您的本地主机( 127.0.0.1
)时 - 它可能无论如何都不会在本地运行。
见 geoip_record_by_name
Docs :
Returns the associative array on success, or
FALSE
if the address cannot be found in the database.
你回来了
FALSE
因为在数据库中找不到该地址。
关于php - geoip_record_by_name 什么都不返回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9633877/