原因:
该字符中含了ASCII码ETB控制符,即\x17导致json解析失败
解决方案:
$params = preg_replace('/[\x00-\x1F]/', '', $params);
$data = json_decode($params, true); echo $errorinfo = json_last_error();
1、先打印报错信息
2、看返回的报错值
3、对应报错值查询表处理
PS:json报错表
0 = JSON_ERROR_NONE
1 = JSON_ERROR_DEPTH
2 = JSON_ERROR_STATE_MISMATCH
3 = JSON_ERROR_CTRL_CHAR
4 = JSON_ERROR_SYNTAX
5 = JSON_ERROR_UTF8
1 = JSON_ERROR_DEPTH
2 = JSON_ERROR_STATE_MISMATCH
3 = JSON_ERROR_CTRL_CHAR
4 = JSON_ERROR_SYNTAX
5 = JSON_ERROR_UTF8