Currently I use Facebook php-sdk.
Example code from the tutorial.
$session = $facebook->getSession();
$me = null;
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}
Now on my edit or submit content I write something like this
if(isset($me)) {
// can edit
} else {
// logout
}
This is working fine, but sometimes the $me
will return to empty a开发者_开发百科rray and user will logout. How to use $me
correctly.
Let me know..
From my test here will working fine
if(isset($me) && $facebook->api('/me')) {
// can edit
} else {
// logout
}
精彩评论