我下面有json字符串,我尝试转换数组,但是我不成功,有人可以帮助我,谢谢。
Example 1 : s:59:"[{"item_id":"UTILITY CON CERNIERA","qty":1,"points":"110"}]";
Example 1 : s:109:"[{"item_id":"UTILITY CON CERNIERA","qty":1,"points":"110"},{"item_id":"PESA VALIGIA","qty":1,"points":"120"}]";
您的数据serialized
也是如此json encoded
。因此,您必须使用:-
json_decode
以及unserialize
如下所示:-
<?php
$data = 's:59:"[{"item_id":"UTILITY CON CERNIERA","qty":1,"points":"110"}]"';
print_r(json_decode(unserialize($data),true));
?>
和
<?php
$data = 's:109:"[{"item_id":"UTILITY CON CERNIERA","qty":1,"points":"110"},{"item_id":"PESA VALIGIA","qty":1,"points":"120"}]"';
print_r(json_decode(unserialize($data),true));
?>
https://eval.in/590757和https://eval.in/590758
有关更多参考:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句