新项目用的 php 7.3.8
版本,在使用过程中发现 浮点类型
数据经过 json_encode
之后会出现精度问题。
调整 php.ini
中 serialize_precision (序列化精度)
的大小来解决这个问题。
; When floats & doubles are serialized store serialize_precision significant
; digits after the floating point. The default value ensures that when floats
; are decoded with unserialize, the data will remain the same.
; The value is also used for json_encode when encoding double values.
; If -1 is used, then dtoa mode 0 is used which automatically select the best
; precision.
serialize_precision = 16