因此,我正在使用facebook-php-sdk,我已经在页面选项卡上创建了一个页面选项卡,我正在尝试使用SDK,它只在我作为页面而不是用户登录到facebook时才起作用,那么这会是什么原因呢?
require 'facebook-php-sdk/src/facebook.php';
$facebook = new Facebook(array(
'appId' => '//APP ID//',
'secret' => '//APP SECRET//',
));
// Get User ID
$user = $facebook->getUser();
// We may or may not have this data based on whether the user is logged in.
//
// If we have a $user id here, it means we know the user is logged into
// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
}
catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
if(isset($user)) {
var_dump($user);
}
else if(isset($user_profile)) {
var_dump($user_profile);
}
else {
echo $loginUrl;
}
var_dump($facebook->getUser());我知道这是error_log:签名不好的JSON签名
发布于 2011-09-11 01:21:28
你正在测试的用户是否连接到该页面(即,喜欢它)?否则,您将不会收到有关该用户是谁的任何信息。这是意料之中的。当用户没有明确地喜欢页面时,Facebook会尽最大努力匿名用户与页面应用程序的交互。
https://stackoverflow.com/questions/7373272
复制相似问题