📜  在 php 代码示例中解析 json 嵌套数组表单 url

📅  最后修改于: 2022-03-11 14:54:50.838000             🧑  作者: Mango

代码示例1
$json = '
{
    "type": "donut",
    "name": "Cake",
    "toppings": [
        { "id": "5002", "type": "Glazed" },
        { "id": "5006", "type": "Chocolate with Sprinkles" },
        { "id": "5004", "type": "Maple" }
    ]
}';

$yummy = json_decode($json, true);

echo $yummy['toppings'][2]['type']; //Maple