Handling big user IDs returned by FQL in PHP

后端 未结 6 2196
时光说笑
时光说笑 2020-11-29 09:30

I\'m using FQL to retrieve a list of users from Facebook. For consistency I get the result as JSON. This causes a problem - since the returned JSON encodes the user IDs as n

6条回答
  •  被撕碎了的回忆
    2020-11-29 09:59

    I had a similar problem where json_decode was converting recent twitter/tweet IDs into exponential numbers.

    Björn's answer is great if you want your BIGINT to become a string - and have PHP 5.3+. If neither of those things are true, another option is to up PHP's float precision. This can be done a different few ways...

    • find the precision value in your php.ini and change it to precision = 20
    • add ini_set('precision', 20); to your PHP app
    • add php_value precision 20 to your app's .htaccess or virtual host file

提交回复
热议问题