-2

我有以下 json 数组。

{"entries":[{"uid":155551338258538,"photo":"https:\/\/m.ak.fbcdn.net\/profile.ak\/hprofile-ak-prn1\/323887_155551338258538_1152153357_q.jpg","type":"user","text":"shikhadamodar","path":"\/shikha.damodar.1","category":"Madiun","names":["shikhadamodar"],"index_rank":-1,"needs_update":true,"non_title_tokens":"madiun"},{"uid":155551332173428,"photo":"https:\/\/m.ak.fbcdn.net\/profile.ak\/hprofile-ak-snc3\/273318_155551332173428_2131571532_q.jpg","type":"user","text":"shreya damodar","path":"\/my.devprofile","category":"Nilai","names":["shreyadamodar"],"index_rank":-1,"needs_update":true,"non_title_tokens":"nilai"},{"uid":155555587232111,"photo":"https:\/\/m.ak.fbcdn.net\/profile.ak\/hprofile-ak-prn1\/41332_155555587232111_3158_q.jpg","type":"user","text":"neha neha","path": "\/neha.neha34","category":"New York, New York","names":["Neha neha"],"index_rank":-1,"needs_update":true,"non_title_tokens":"new york, new york"}],"token":"1333551453-7","display_token":5,"display_ttl":1333541132}

当我解码这个 json 数组时,我得到了,

array(4){["entries"]=>array(3){[0]=>array(10){["uid"]=>float(1.5555133825854E+14)["photo"]=>string(90) "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn1/323887_155551338258538_1152153357_q.jpg"["type"]=>string(4) "user"["text"]=>string(13) "shikhadamodar"["path"]=>string(17) "/shikha.damodar.1"["category"]=>string(6) "Madiun"["names"]=>array(1){[0]=>string(13) "shikhadamodar"}["index_rank"]=>int(-1)["needs_update"]=>bool(true)["non_title_tokens"]=>string(6) "madiun"}[1]=>array(10){["uid"]=>float(1.5555133217343E+14)["photo"]=>string(90) "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-snc3/273318_155551332173428_2131571532_q.jpg"["type"]=>string(4) "user"["text"]=>string(14) "shreya damodar"["path"]=>string(14) "/my.devprofile"["category"]=>string(5) "Nilai"["names"]=>array(1){[0]=>string(13) "shreyadamodar"}["index_rank"]=>int(-1)["needs_update"]=>bool(true)["non_title_tokens"]=>string(5) "nilai"}[2]=>array(10){["uid"]=>float(1.5555558723211E+14)["photo"]=>string(83) "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn1/41332_155555587232111_3158_q.jpg"["type"]=>string(4) "user"["text"]=>string(9) "neha neha"["path"]=>string(12) "/neha.neha34"["category"]=>string(18) "New York,New York"["names"]=>array(1){[0]=>string(9) "Neha neha"}["index_rank"]=>int(-1)["needs_update"]=>bool(true)["non_title_tokens"]=>string(18) "new york,new york"}}["token"]=>string(12) "1333551453-7"["display_token"]=>int(5)["display_ttl"]=>int(1333541132)}

json 中的第一个 UID 是 "uid":155551338258538,

当涉及到数组时,它变成了["uid"]=>float(1.5555133825854E+14)

为什么会这样??

获得结果后1.5555133825854E+14,我可以将其更改为真实的 UID155551338258538 吗?

希望一些伟大的编码器可以帮助解决这个问题。

4

1 回答 1

1

我发现您的问题的解决方案 UID 字符串很长,因此 json_decode 将其转换为科学记数法。尝试这个

print_r(json_decode($arr, false,512, JSON_BIGINT_AS_STRING)); 
于 2013-04-23T05:37:12.283 回答