如何使用PHP阅读此JSON?

我是JSON格式的新手,在我阅读的教程中,我不太清楚如何使用PHP解析.所以我有这个:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -67.593742,
                    10.24462
                ]
            },
            "properties": {
                "id": "669163449",
                "accuracyInMeters": 0,
                "timeStamp": 1301841780,
                "reverseGeocode": "Maracay, Venezuela",
                "photoUrl": "https://www.google.com/latitude/apps/badge/api?type=photo&photo=Df7VGy8BAAA.9of56owsf4wI6F4odEQ",
                "photoWidth": 96,
                "photoHeight": 96,
                "placardUrl": "https://g=true&stale=false&lod=4&format=png",
                "placardWidth": 56,
                "placardHeight": 59
            }
        }
    ]
}

我想要回显坐标和reverseGeocode.任何人都可以把我放在正确的方向吗?

解决方法:

试试跑步

$decoded = json_decode($json_string, true);
print_r($decoded);
print_r($decoded["features"][0]["geometry"]["coordinates"]);
echo $decoded["features"][0]["properties"]["reverseGeocode"];

其中$json_string是您的样本JSON作为字符串.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...