PHP SDK 3.1.1 getUser() sometimes return 0

前端 未结 5 925
日久生厌
日久生厌 2020-12-17 21:32

This is driving me crazy >=(

$facebook->getUser() works well sometimes, but sometimes returns 0

Here is my code: require \'fbapi/facebook.php\';
$

5条回答
  •  猫巷女王i
    2020-12-17 21:44

    I found a simple solution to this problem.. this happens when facebook class is not able to set or add session variable on your server..

    In my code i used session_write_close() before including facebook classes because of which i got this error.. "CSRF state token does not match one provided."..

    I then moved session_write_close() at the end of the code and finally it worked.. :)

提交回复
热议问题