我需要帮助解码这个,这是json吗?

时间:2015-08-19 01:19:05

标签: php mysql json

这是json吗?我需要回复某些信息并且无法做到这一点。我尝试过json_decode,它似乎不起作用。

a:4:{s:5:"entry";a:1:{s:4:"type";s:10:"individual";}s:5:"group";a:1:{s:6:"family";a:0:{}}s:5:"image";a:3:{s:6:"linked";b:1;s:7:"display";b:1;s:4:"name";a:4:{s:9:"thumbnail";s:19:"jim12_thumbnail.jpg";s:5:"entry";s:15:"jim12_entry.jpg";s:7:"profile";s:17:"jim12_profile.jpg";s:8:"original";s:18:"jim12_original.jpg";}}s:4:"logo";a:3:{s:6:"linked";b:1;s:7:"display";b:1;s:4:"name";s:14:"jim12_logo.jpg";}}

1 个答案:

答案 0 :(得分:3)

使用

$decode = unserialize('a:4:{s:5:"entry";a:1:{s:4:"type";s:10:"individual";}s:5:"group";a:1:{s:6:"family";a:0:{}}s:5:"image";a:3:{s:6:"linked";b:1;s:7:"display";b:1;s:4:"name";a:4:{s:9:"thumbnail";s:19:"jim12_thumbnail.jpg";s:5:"entry";s:15:"jim12_entry.jpg";s:7:"profile";s:17:"jim12_profile.jpg";s:8:"original";s:18:"jim12_original.jpg";}}s:4:"logo";a:3:{s:6:"linked";b:1;s:7:"display";b:1;s:4:"name";s:14:"jim12_logo.jpg";}}')

然后

print_r($decode);

获取有关对象的信息

修改

它只是一个数组,您可以通过这种方式访问​​它的信息:

$decode['image']['name']['thumbnail']

在此示例中,您将获得缩略图值