douzhi1937 2012-05-20 21:27
浏览 44
已采纳

为什么Facebook PHP SDK logouturl实际上没有将用户注销?

I am using the Facebook PHP sdk, and after the user logs in, I show a link for the logout URL using $facebook->getLogoutUrl().

But when the user clicks on that link, it seems to go to Facebook and redirect right back to my main index.php at which point the user still seems to have been logged in, because $facebook->getUser(); returns a valid user.

How do I actually fully log the user out?

  • 写回答

1条回答 默认 最新

  • dongwujie7477 2012-05-20 21:36
    关注

    getLogoutUrl method returns a URL that, when clicked by the user, will log them out of their Facebook session and then redirect them back to your application.

    Ideally after logging the user out, user will be redirected back to the application but $facebook->getUser(); returns 0.

    This should help you.

    EDIT:

    Best way is to use something like below

    $logoutParams = array(
    'next'  =>  'http://your-site/your-application/after_logout.php'
    );
    

    and also destroy sessions session_destroy();

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题