Inf and NaN cannot be JSON encoded

json_encode 放回false
echo json_encode($array);

通过json_last_error_msg查看报错原因
echo json_last_error_msg();
Inf and NaN cannot be JSON encoded

原因是$array里面包含了NAN 和INF 这些导致的

解决方案如下:

json_encode(unserialize(str_replace(array(‘NAN;’,’INF;’),’0;’,serialize($reply))));

猜你喜欢

转载自blog.csdn.net/u014574478/article/details/95225381
inf
NaN