我正在制作一个 facebook 画布应用程序。要使用 PHP SDK 获取用户信息,请执行以下操作:
<?
$app_id = "";
$secret="";
$canvas_page = "";
$auth_url = "";
$facebook = new Facebook(array(
'appId' => '',
'secret' => '',
));
// Get User ID
$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) {
error_log($e);
$user = null;
}
}
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
$user = $facebook->api('/me');
?>
除 IE(所有版本)外,所有浏览器都可以正常工作。当我单击应用程序内另一个页面的链接时,我收到下一个错误:
Fatal error: Uncaught OAuthException: An active access token must be used to query
information about the current user. thrown in
/hermes/bosoraweb019/b2365/ipg.zicedcom/metrik/fbapp/fb/base_facebook.php on line
我刚刚显示的代码在应用程序内的所有页面中,我只在 IE 中遇到这个问题
谢谢!