返回首页
当前位置: 主页 > 网络编程 > Php实例教程 >

php 长整型转字符串 (convert long to string)

时间:2018-11-24 22:33来源:知行网www.zhixing123.cn 编辑:麦田守望者

问题描述:

原始数据 (before deal)
{"id":5730528714937479169,"fullname":"rourou","email":null,"mobile":"1391730****","description":null}

json_decode后 (after json_decode)
array(5) { ["id"]=> float(5.7305287149375E+18) ["fullname"]=> string(6) "rourou" ["email"]=> NULL ["mobile"]=> string(11) "1391730****" ["description"]=> NULL }

处理方法(deal method)
$response={"id":5730528714937479169,"fullname":"rourou","email":null,"mobile":"1391730****","description":null}
preg_replace('/^\{"id":(\d{1,})./', '{"id":"\\1",', $response);

处理后(after deal)
$response={"id":"5730528714937479169","fullname":"rourou","email":null,"mobile":"1391730****","description":null}

------分隔线----------------------------
标签(Tag):php 长整型转字符串
------分隔线----------------------------
推荐内容
猜你感兴趣
博聚网