我正在使用 sdk 附带的 facebook 示例 javascript 代码,但没有运气我使用的是最新的 3.2.2 SDK
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => '---------',
'secret' => '----------',
));
// See if there is a user from a cookie
echo $user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
$user = null;
}
}