php json_decode json字符串返回NULL

一般来说用可能存在的基本情况

1:json基本格式不正确,首先检查这一点

2:带有bom头,用urlencode检查一下头部,如果有,删除掉

3:带有http://www.xxx.com这样类似的反斜杠,替换掉即可

进行上面操作之后基本就能转了

        $res = json_decode(str_replace("\",'',urldecode(str_replace("%EF%BB%BF",'',urlencode($tmpdata)))));
原文地址:https://www.cnblogs.com/Lynwood/p/9436534.html