當前位置:成語大全網 - 新華字典 - php 讀取 json 裏面的字段內容

php 讀取 json 裏面的字段內容

示例代碼如下:

<?php

header("Content-type:?text/html;?charset=utf-8");

$postArray?=?'[{"count":{"左腦":2,"右腦":3,"全腦":2,"全腦1":1},"score":{"左腦":8,"右腦":14,"全腦":15,"全腦1":8},"pingjun":{"左腦":4,"右腦":4.6666666666667,"全腦":7.5,"全腦1":8}}]';

$de_json?=?json_decode($postArray,?true);

echo?$de_json[0]['pingjun']['左腦'];

>

json 數組結構如圖: