【发布时间】:2016-05-05 22:07:05
【问题描述】:
我安装了geocoder-php/GeocoderLaravel 包并根据文档进行了配置。然后我在控制器函数中运行了一个小测试,它发送到谷歌,解析地址并成功返回地理编码对象,但它受到保护,我无法访问它。这是怎么回事?
代码:
$geocode = Geocoder::geocode('9900 Sowder Village Square, Manassas, VA 20109');
var_dump($geocode);
输出:
object(Geocoder\Result\Geocoded)#189 (15) {
["latitude":protected]=> float(38.7392838)
["longitude":protected]=> float(-77.5348982)
["bounds":protected]=> array(4) {
["south"]=> float(38.7392838)
["west"]=> float(-77.5348982)
["north"]=> float(38.7392838)
["east"]=> float(-77.5348982)
}
["streetNumber":protected]=> string(4) "9900"
["streetName":protected]=> string(21) "Sowder Village Square"
["cityDistrict":protected]=> NULL
["city":protected]=> string(8) "Manassas"
["zipcode":protected]=> string(5) "20109"
["county":protected]=> string(21) "Prince William County"
["countyCode":protected]=> string(21) "PRINCE WILLIAM COUNTY"
["region":protected]=> string(8) "Virginia"
["regionCode":protected]=> string(2) "VA"
["country":protected]=> string(13) "United States"
["countryCode":protected]=> string(2) "US"
["timezone":protected]=> NULL
}
我在互联网上搜索并找到了有关反射的资料,但我认为它不可能那么复杂。这家伙在 gitHub 上的文档很烂。有什么指导吗?
感谢您抽出宝贵时间。
乔什
【问题讨论】: