本文介绍了设置反向地理编码Gmaps v.3的语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人现在如何为反向地理编码php响应设置语言吗? (始终设置为en)
do anybody now how to set language for reverse geocoding php response ? (always set en)
**Here is the code**
<code>
$api_key = "***";
$url = 'http://maps.google.com/maps/geo?q=49.8411860,30.1066580&output=json&sensor=true_or_false&key=' . $api_key.'&language=uk';
$data = @file_get_contents($url);
$jsondata = json_decode($data,true);
if(is_array($jsondata )&& $jsondata ['Status']['code']==200) {
$addr = $jsondata ['Placemark'][0]['address'];
}
echo $addr;
</code>
**The Output is**
"L'va Tolstoho street, Bila Tserkva, Kyivs'ka oblast, Ukraine"
推荐答案
如果您希望使用英语,则将URI变量语言更改为"en",即& language = zh-CN
If you want English then change your URI variable language to 'en' i.e. &language=en
$url = 'http://maps.google.com/maps/geo?q=49.8411860,30.1066580&output=json&sensor=true_or_false&key=' . $api_key.'&language=en';
这篇关于设置反向地理编码Gmaps v.3的语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!