我有以下代码:
$facebook = new Facebook(array(
'appId' => '###',
'secret' => '###'
));
$user = $facebook->getUser();
Run Code Online (Sandbox Code Playgroud)
$ user总是0,我的AppId和Secret都是100%正确的.我究竟做错了什么?
小智 4
确保您有 if 条件来检查用户状态
$user=$facebook->getUser();
if($user)
//someactions
else
{
// redirect the user to login and authorize your application, if necessary
header('Location:'.$facebook->getLoginURL());
}
Run Code Online (Sandbox Code Playgroud)
请检查函数的大小写。我可能错了。
| 归档时间: |
|
| 查看次数: |
5237 次 |
| 最近记录: |