Jimmy小站
小明也有大梦想 — 蒋明/铭PHP json_decode() 返回类型问题
2016-12-03 / 未分类 / 3857 次围观 / 0 次吐槽It decode correctly,It show the result correctly when I debug code. but when I try to access the info inside the array,such as
when I tried to do: $data['isExtra'] = 0 and $data has been modified,
and I get the Error:
Fatal error: Cannot use object of type stdClass as array inC:\Users\Dail\software\abs.php on line 108
Now we can solve this issue by using the code as below:
$data= json_decode('sourceStr', true); Adding the second parameter as true to returns the result as an array and not an stdClass.
推荐您阅读更多有关于“PHP,”的文章
本月热文
Copyright © Jimmy小站 Allrights Reserved.备案号:桂ICP备 15005996
额 本文暂时没人评论 来添加一个吧
发表评论