我在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
后,我可以将其更改为真正的UID 155551338258538
?
希望一些优秀的程序员可以为此提供帮助。
答案 0 :(得分:1)
我找到了你的问题的解决方案,UID字符串是长整数,因此json_decode将其转换为科学记数法。试试这个
print_r(json_decode($arr, false,512, JSON_BIGINT_AS_STRING));