Possible Bug: Facebook Events API eid table values being returned with decimal points raw

旧时模样 提交于 2019-12-12 05:39:34

问题


I built a custom wordpress widget months ago that just pulls a users facebook events, styles and shows it in the sidebar. The events are still showing up fine - except that the links now go to an facebook error page. So I checked the echo'd url and this is what I got :

https://www.facebook.com/events/4.3772330960996E+14

Obviously the url, ending at events/ is hard-coded and the number that follows is an echo is a for loop. Which has been working clean for about 6mo.

At first I thought maybe it was returning an Integer that was being converted somehow.. but I checked the actual event id from facebook.com and this is what is was:

437723309609959

I think fb api is putting a decimal point where it had never been before.

Just to clarify: I am using PHP - using FQL through the GRAPH with CURL. And then echoing the raw row info.

Thoughts?


回答1:


Change your precision setting in php.ini, or directly in code:

ini_set('precision', 20);



回答2:


You must be using a 32-bit version of PHP, where the largest integer is 2147483647

Try using printf instead of echo:

printf('http://graph.facebook.com/events/%s', $eid);


来源:https://stackoverflow.com/questions/13313401/possible-bug-facebook-events-api-eid-table-values-being-returned-with-decimal-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!