FacebookSDKException:会话未激活,无法存储状态 [英] FacebookSDKException: Session not active, could not store state

查看:68
本文介绍了FacebookSDKException:会话未激活,无法存储状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白为什么会出现这种异常:

I don't understand why I'm getting this exceptions:

Session not active, could not store state.

代码是:

<?php

require 'vendor/autoload.php';

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;

FacebookSession::setDefaultApplication('foo', 'baz');

$helper = new FacebookRedirectLoginHelper('bar');
$loginUrl = $helper->getLoginUrl();

?>

请帮助.

推荐答案

您需要使用session_start()启动会话,以使Facebook SDK正常工作.请将此代码添加到您的代码中以解决此问题.

You need to start a session using session_start() for the Facebook SDK to work correctly. Please add this to your code to fix the issue.

示例:

<?php

session_start();

require 'vendor/autoload.php';

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;

...

这篇关于FacebookSDKException:会话未激活,无法存储状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆