php 長整型轉字符串 (convert long to string)

問題描述:php

原始數據 (before deal)json

{"id":5730528714937479169,"fullname":"rourou","email":null,"mobile":"1391730****","description":null}

json_decode後 (after json_decode)post

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

處理方法(deal method)code

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

處理後(after deal)ip

$response={"id":"5730528714937479169","fullname":"rourou","email":null,"mobile":"1391730****","description":null}

轉載自:http://www.9958.pw/post/php_long_to_stringget

相關文章
相關標籤/搜索