开发者

Error when running Facebook APP [duplicate]

开发者 https://www.devze.com 2023-04-13 07:44 出处:网络
This question already has answers here: How to fix "Headers already sent" error in PHP (11 answers)
This question already has answers here: How to fix "Headers already sent" error in PHP (11 answers) Closed 10 years ago.

I'm creating a test app in facebook, so I'm trying to access to user info so I prompt the user accept window, when creating the $facebook->getSession() it shows me this error:

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

Somebody knows how to solve this, I'm not a guru on servers or less... Thanks!


change to $facebook->getUser(); instead. This is what is used in php-sdk 3.1.1. the most recent build. You may need to update. 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;
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消