我正在facebook中创建一个测试应用程序,所以我正在尝试访问用户信息,所以我提示用户接受窗口,在创建$ facebook-> getSession()时它显示了这个错误:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /nfs/c05/h01/mnt/78225/domains/apps.royalworkshop.com/html/fb/index.php:2) in /nfs/c05/h01/mnt/78225/domains/apps.royalworkshop.com/html/fb/src/facebook.php on line 37
Fatal error: Call to undefined method Facebook::getSession() in /nfs/c05/h01/mnt/78225/domains/apps.royalworkshop.com/html/fb/index.php on line 14
有人知道如何解决这个问题,我不是服务器上的大师或更少...谢谢!
答案 0 :(得分:2)
更改为$ facebook-> getUser();代替。这是php-sdk 3.1.1中使用的内容。最新的版本。您可能需要更新。 https://developers.facebook.com/docs/reference/php/
$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;
}
}