php and nested json: how can i access this element?

前端 未结 3 1703
迷失自我
迷失自我 2021-01-02 07:51

Here\'s the json text:

{
\"data\": {
    \"current_condition\": [{
        \"cloudcover\": \"75\",
        \"humidity\": \"63\",
        \"observation_time\"         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-02 08:31

    That´s not how you access arrays in PHP

    $array['index']="value";
    
    echo $array['index1']['index2']
    

    For your example:

    echo $arr['data']['current_condition'][0]['temp_F']
    

提交回复
热议问题