php json_decode 后,数字对象转换成了 科学计数法
$obj='{"order_id":213477815351175,"buyer":100001169269154}';
$obj=$this->json_decode($obj,TRUE);
print_r($obj);
结果:
Array
(
[order_id] => 2.1347781535118E+14
[buyer] => 1.0000116926915E+14
)
最后使用 php自带函数 number_format(),问题得到解决,效果如下:
$obj='{"order_id":213477815351175,"buyer":100001169269154}';
$obj=$this->json_decode($obj,TRUE);
foreach ($obj as $key=>$val){
$obj[$key]=number_format($val,0,'','');
}
print_r($obj);
结果:
Array
(
[order_id] => 213477815351175
[buyer] => 100001169269154
)