简体   繁体   English

json_decode变量php

[英]json_decode variables php

I'm simply trying to extract variables from a json_decode 我只是想从json_decode中提取变量

the resulting decoded code (a snippet of) is: 得到的解码代码(片段)为:

auth_info:
array(4) {
["profile"]=>
  array(13) {
  ["name"]=>
  array(3) {
  ["givenName"]=>
  string(6) "John"
  ["familyName"]=>
  string(7) "Doe"
  ["formatted"]=>
  string(14) "John Doe"
  }
 }
}

I'm trying all things such as: 我正在尝试所有事情,例如:

echo "\n\nMy name is ".$auth_info['profile']->name->givenName;

But all to no avail..ideas please? 但是,一切都没有。

Many thanks as always 一如既往的感谢

Darren 达伦

它们都是数组,尝试一下。

$auth_info['profile']['name']['givenName']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM