如果我使用这种和平的代码:
$facebook = new Facebook(array(
'appId' => APP_ID,
'secret' => APP_SECRET,
'cookie' => true,
));
?>
<html>
<head></head>
<body>
<?
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$userData = $facebook->api("/me");
echo "Name: " . $userData['name'];
echo "<br>userData: " . print_r($userData);
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
// If a user haven't been loged in, so the user have to authorize
if (!$user) {
$loginUrl = $facebook->getLoginUrl(
array(
'scope' => 'publish_stream',
'redirect_uri' => APP_BASEHREF
)
);
echo("<script> top.location.href='" . $loginUrl . "'</script>");
}
我只得到这个回应:
Name: userData: 1
我不知道这个问题。用户已正确登录。我也与一些有相同问题的测试用户一起尝试。似乎 api 调用无法正常工作。但为什么。你能帮帮我吗?
仍然没有解决方案,有人可以帮助我吗?谢谢