标签: php google-maps curl google-maps-api-3
https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_API_KEY
我想从Google API返回的地址中获取city,state和zipcode。
city
state
zipcode
现在我必须从以下字符串中爆炸
"formatted_address" : "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA",
答案 0 :(得分:4)
您可以使用array_filter过滤每个address_components的{{1}}字段:
array_filter
address_components
types