【发布时间】:2012-12-30 11:15:12
【问题描述】:
$location = "http://www.geoplugin.net/php.gp?ip=115.67.131.206";
$geoplugin = unserialize(file_get_contents($location));
$country = $geoplugin['geoplugin_countryName'];
$city = $geoplugin['geoplugin_city'];
我在 IIS 上运行上述 PHP 代码(来自 Geoplugin 的示例),它运行良好,返回国家和城市;但是,当从公共托管服务器运行时,不会返回任何内容,也不会显示错误。我错过了什么?
【问题讨论】:
-
检查你的配置php.net/manual/en/…
-
在开头添加这段代码并再次运行。
error_reporting(-1); ini_set('display_errors', 1); ini_set('display_startup_errors', 1);你会看到错误
标签: php geolocation