将不同的json变量分开

时间:2018-08-14 21:26:36

标签: php json

我有这个json(部分)

{
  "actual": {
        "image": {
        "title":"Pronostico 3 dias"

        },
    "forecast":{
        "txt": {
        "fecha":"5:08 PM -03",
        "forecastdia": [
        {
        "dia":0,
        "icon":"partlycloudy",
        "title":"Tuesday",
        "pop":"20"
        }
        ,
        {
        "dia":1,
        "icon":"nt_partlycloudy",
        "title":"Tuesday Night",
        "pop":"20"
        }
        ,
        {
        "dia":2,
        "icon":"clear",
        "title":"Wednesday",
        "pop":"0"
        }
        ,
        {
        "dia":3,
        "icon":"nt_clear",
        "title":"Wednesday Night",
        "pop":"0"
        }
        ,
        ]
        },

}

{ "actual": { "image": { "title":"Pronostico 3 dias" }, "forecast":{ "txt": { "fecha":"5:08 PM -03", "forecastdia": [ { "dia":0, "icon":"partlycloudy", "title":"Tuesday", "pop":"20" } , { "dia":1, "icon":"nt_partlycloudy", "title":"Tuesday Night", "pop":"20" } , { "dia":2, "icon":"clear", "title":"Wednesday", "pop":"0" } , { "dia":3, "icon":"nt_clear", "title":"Wednesday Night", "pop":"0" } , ] }, } 我需要用php数组Forecastdia分隔变量。例如

  1. $ icon0 =部分多云
  2. $ icon1 = nt_partlycloudy

我该怎么做? 有人可以引导我吗? 最好的问候

Carina

0 个答案:

没有答案