json_decode()相关报错

错误描述

  PHP Warning:  json_decode() expects parameter 1 to be string, array given in xxx.php on line 299

原因分析

  json_decode函数是用来解码json_encode编码后的函数,他的参数是必须是一个json字符串,上面的错误就是给json_decode传入的参数是一个数组导致的报错

解决方法

  根据错误行号找到代码段,检查是否给json_decode传入的不是一个json字符串。

posted @ 2018-12-24 22:45  。思索  阅读(11115)  评论(0)    收藏  举报