简体   繁体   中英

json_decode variables php

I'm simply trying to extract variables from a 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']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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