我想分别从 geoplugin 数组中获取每个项目。
这是我的示例代码 -
$location_info = file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']);
echo$location_info;
这里是数组中的响应
a:24:{s:17:"geoplugin_request";s:12:"76.180.83.10";s:16:"geoplugin_status";i:200;s:15:"geoplugin_delay";s:3:"1ms";s:16:"geoplugin_credit";s:145:"Some of the returned data includes GeoLite data created by MaxMind, available from http://www.maxmind.com.";s:14:"geoplugin_city";s:7:"Buffalo";s:16:"geoplugin_region";s:8:"New York";s:20:"geoplugin_regionCode";s:2:"NY";s:20:"geoplugin_regionName";s:8:"New York";s:18:"geoplugin_areaCode";s:0:"";s:17:"geoplugin_dmaCode";s:3:"514";s:21:"geoplugin_countryCode";s:2:"US";s:21:"geoplugin_countryName";s:13:"United States";s:14:"geoplugin_inEU";i:0;s:19:"geoplugin_euVATrate";b:0;s:23:"geoplugin_continentCode";s:2:"NA";s:23:"geoplugin_continentName";s:13:"North America";s:18:"geoplugin_latitude";s:7:"42.9297";s:19:"geoplugin_longitude";s:8:"-78.7434";s:32:"geoplugin_locationAccuracyRadius";s:1:"5";s:18:"geoplugin_timezone";s:16:"America/New_York";s:22:"geoplugin_currencyCode";s:3:"USD";s:24:"geoplugin_currencySymbol";s:5:"$";s:29:"geoplugin_currencySymbol_UTF8";s:1:"$";s:27:"geoplugin_currencyConverter";s:1:"1";}
示例 - 我想获取城市并从此数组中回显它
$city = ['geoplugin_city'];
echo$city;
12345678_0001