<?php
session_start();
require_once 'Facebook/facebook.php';
$facebook = new Facebook(array(
'appId' => "347086135470127",
'secret' => "f6d61cc9688ca34a0765f2ddbb138998",
'cookie' => true,
'domain' => "tinser.host56.com"
));
$session = $facebook->getUser();
echo $session;
if($session == 0) {
$loginUrl = $facebook->getLoginUrl(array(
'display' => 'popup',
'redirect_uri' => 'http://tinser.host56.com/lib/php/facebookinit.php'
));
$logoutUrl = $facebook->getLogoutUrl(array('redirect_uri' => 'http://tinser.host56.com/lib/php/facebookinit.php'));
echo "<a href='$loginUrl'>Login with facebook</a><br><a href='$logoutUrl'>Logout with facebook</a>";
} else {
$api = $facebook->api('me');
print_r($api);
}
?>
<小时/> 它说CSRF状态令牌无效。我试图纠正base_facebook.php中的
getCode()
。这是行不通的。 PHP SDK版本:3.2.3。我等待你的回应。感谢