简体   繁体   中英

Serialized PHP array in Flickr

I have this serialized array but I have no idea how to get the id: 7796249@N02

a:2:{s:4:"user";a:3:{s:2:"id";s:11:"7796249@N02";s:4:"nsid";s:11:"7796249@N02";s:8:"username";a:1:{s:8:"_content";s:9:"ilhan.z.y";}}s:4:"stat";s:2:"ok";}


$array = unserialize('a:2:{s:4:"user";a:3:{s:2:"id";s:11:"7796249@N02";s:4:"nsid";s:11:"7796249@N02";s:8:"username";a:1:{s:8:"_content";s:9:"ilhan.z.y";}}s:4:"stat";s:2:"ok";}');

Here's where the id is:

$array['user']['id'];

Next time, use print_r() or var_dump() :

echo '<pre>';
print_r($array);
var_dump($array);
echo '</pre>';

to see a human-readable representation of the array.

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