<?php
require_once('facebook.php');
`$facebook=new Facebook(array(
'appId'=>'APP_ID',
'secret'=>'SECRET',
'cookie'=>true,
));
$session = $facebook->getSession();
if(!empty($session))
{
try{
$uid=$facebook->getUser();
$user=$facebook->api('/me');
}
catch(Exception $e){}
if(!empty($user))
{
if($_GET[installed]=='1')
{
header("Location: http://apps.facebook.com/telebuytest");
}
echo "hi".$user['first_name'];
}
else
{
die("an error occured");
}
}
else
{
$url = $facebook->getLoginUrl();
echo "<a href='".$url."'>click here to add app";
}
?>
$session = $facebook->getSession(); 之后没有任何效果 声明,但似乎代码没有错
如果我删除该代码并放入一些 html 内容它工作正常