简体   繁体   中英

how to parse the API response data using php?

I got below data in API response

{ secret: 'sn2MtJE1tDeESuuYcc7hBAJBGRABX', address: 'rwY9uCHHZkHTyns5Cwc5NHXLptkmNUs4Qv' }

i want parse array format like below, Using php

array(secret=>sn2MtJE1tDeESuuYcc7hBAJBGRABX,address=>rwY9uCHHZkHTyns5Cwc5NHXLptkmNUs4Qv)
$json = /* your json variable*/
$json = '{"secret":"sn2MtJE1tDeESuuYcc7hBAJBGRABX","address":"rwY9uCHHZkHTyns5Cwc5NHXLptkmNUs4Qv"}';

$array = json_decode($json,true);

print_r($array);

Array ( [secret] => sn2MtJE1tDeESuuYcc7hBAJBGRABX [address] => rwY9uCHHZkHTyns5Cwc5NHXLptkmNUs4Qv )

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