您的位置:首页 > 编程语言 > PHP开发

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

2016-03-16 00:00 281 查看
问题描述:

原始数据 (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}


转载自:http://www.9958.pw/post/php_long_to_string
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php