2015-10-05 48 views
1

我在從API這個格式的數據:得到的API數據

{ 
"key1": 2300, 
"key2": 152, 
    "key3": 5, 
    "key4": 18, 
    "key5": "value", 
    "players": [ 
    { 
     "avatar": { 
     "name": "name", 
     "id": 73019554141, 
     "key": 34361224375 
     }] 
    "players": [ 
    { 
     "avatar": { 
     "name": "name", 
     "id": 73019554141, 
     "key": 34361224375 
     }] 
     } 

我使用$jsondata = file_get_contents($url); //get the content from the url$data = json_decode($jsondata, true);檢索數據。我可以使用這些數據:

 $key1= $data['key1']; 
     $key2= $data['key2']; 

我該如何獲得玩家值?

+0

的[?我如何從JSON中提取數據與PHP(可能的複製http://stackoverflow.com/questions/29308898/怎麼辦-I-提取數據從 - JSON-與-PHP) –

回答