2

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

http://www.webdesigncc.info/demoz/myfacebook/examples/example.php

4

2 回答 2

2

Using the following way you can clear all datas.

public function destroySession() {
    $this->setAccessToken(null);
    $this->user = 0;
    $this->clearAllPersistentData();
}
于 2013-06-04T13:53:30.893 回答
2

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

   header("Location:$logout");
 }
于 2013-06-04T15:45:37.007 回答