解决php中json_decode的异常JSON_ERROR_CTRL_CHAR (json_last_error = 3)
https://www.cnblogs.com/sanshuiqing/p/6022619.html
该字符中含了ASCII码ETB控制符,即\x17导致json解析失败 (截图中显示ETB是因为用了Sublime text2)
解决方法如下:去掉0-31的控制符再进行decode
$result = "json格式字符串如图"; $result = preg_replace('/[\x00-\x1F]/','', $result); $result = json_decode($result);