我使用下面的脚本:返回单个变量从阵列
http://www.micahcarrick.com/php-zip-code-range-and-distance-calculation.html
要获得一个邮政编码的细节,我用这:
$selected = $z->get_zip_details($zip);
$result = implode(",", $selected);
echo $result;
这将返回的所有细节“$拉链”:
32.9116,-96.7323,达拉斯,达拉斯,德克萨斯州,得克萨斯州,214,中央
任何1都可以帮助我使脚本只返回城市变量?该脚本的常见问题解答如下:
get_zip_details($zip)
Returns the details about the zip code: $zip. Details are in the form of a keyed array. The keys are: latitude, longitude, city, county, state_prefix, state_name, area_code, and time_zone. All are pretty self-explanitory. Returns false on error.
不幸的是我无法弄清楚如何获得单个值(城市)。将不胜感激任何帮助!
谢谢!
非常感谢!我试图做echo $ get_zip_details ['city'];以及更多!它现在工作正常,我会记住它的未来:) – Andrej 2011-03-17 10:20:23