[英]PHP json_decode() not decoding JSON array
I have a JSON string in my database such as this... 我的数据库中有这样的JSON字符串...
a:1:{s:26:"abcdefghi@jklmnopqrstu.com";s:26:"abcdefghi@jklmnopqrstu.com";}
After I fetch it from the database I use the following... 从数据库中获取后,我将使用以下内容...
$my_array = json_decode($row2['json_data']);
The problem is that I'm not getting any array from $my_array
. 问题是我没有从
$my_array
获得任何数组。 What am I doing wrong? 我究竟做错了什么?
I've also tried the following... 我也尝试了以下方法...
$my_array = json_decode($row2['json_data'],true);
That's not a JSON string. 这不是JSON字符串。 That's a serialized array.
那是一个序列化的数组。 You need to do the following:
您需要执行以下操作:
$my_array = unserialize($row2['json_data']);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.