PHP JSON编码.回声值 [英] PHP JSON encode. Echo value

查看:67
本文介绍了PHP JSON编码.回声值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要回显摘要"的值

    {  
   "expand":"names",
   "startAt":0,
   "maxResults":50,
   "total":1,
   "issues":[  
      {  
         "expand":"example",
         "id":"129018",
         "self":"https://example.com",
         "key":"914",
         "fields":{  
            "summary":"Hello there"
         }
      }
   ]
}

下面的代码不起作用:

$array_result = json_decode($run_curl, true);
    $title = $array_result['issues']['fields']['summary];

我在这里做错了什么?我很确定这很简单而且很明显.

What am I doing wrong here? I am pretty sure it's smth simple and obvious.

推荐答案

issues是一个数组,将其传递给这样的索引:

issues is an array, pass it an index like this:

$title = $array_result['issues'][0]['fields']['summary'];

注意[0].

这篇关于PHP JSON编码.回声值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆