Sign up ×

I have visited this link but cant get any help

$facebook->getUser() ALWAYS Returning ID - Can't Logout

the problem is when $facebook->getLogoutUrl is executed it just logout the user from facebook means destroy the facebook session but data return by the app is still there on the page. how to clear that data.
what i want is when logout link is clicked than the data on my app page also clear and login with facebook link appears.

here is the link to my example page

share|improve this question
Try to unset $facebook object... unset($facebook). That might work. –  Luigi Siri Jun 4 '13 at 13:46

2 Answers 2

up vote 2 down vote accepted

This may solve your problem

 function facebook_logout()
   $logout = $facebook->getLogoutUrl(array('next'=>'your url to be redirected after logout')); 

   $facebook->destroySession(); /*To destroy facebook sessions. 
                                  Available in facebook php sdk*/

   $session_destroy(); //Optional if you want to destroy your site's sessions

share|improve this answer

Using the following way you can clear all datas.

public function destroySession() {
    $this->user = 0;
share|improve this answer

Your Answer


