简体   繁体   中英

How can I get a specific value from the json_decode?

$data = json_decode ($response, true);

print_r($data);

Array (
      ['statusCode'] => 200 ,
      ['body'] => '{ "userid": [admin", "test"] }'
);

I wanna get a print here.

print_r($data['userid'][0]);

There's no result.

How can I get a specific value from the json_decode ?

The body seems to be a json So you need to do json_decode ($data [body])

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