Object of class stdClass could not be converted to string

647 阅读1分钟

问题:
json_decode($json) 解析json字符串成对象后不能将,对象进行echo输出,不能转字符串,不能直接[”]取属性。

解决:
json_decode($json, true) ;即可。

应该习惯性在调用json_decode方法时跟上第二个参数true!