运行example code for the Facebook API我得到一个空会话对象,我应该得到一个非空对象,在代码中给出注释。 我在做什么错?
换句话说,在我的index.php从示例代码此片段显示“无会话”当我去http://apps.facebook.com/my_app
在我的浏览器:
<?php
require './facebook.php';
// Create our Application instance.
$facebook = new Facebook(array(
'appId' => '...', // actual value replaced by '...' for this post
'secret' => '...', // actual value replaced by '...' for the post
'cookie' => true,
));
// We may or may not have this data based on a $_GET or $_COOKIE based session.
//
// If we get a session here, it means we found a correctly signed session using
// the Application Secret only Facebook and the Application know. We dont know
// if it is still valid until we make an API call using the session. A session
// can become invalid if it has already expired (should not be getting the
// session back in this case) or if the user logged out of Facebook.
$session = $facebook->getSession();
if ($session) {
echo "session ok";
}
else {
echo "no session";
}
?>
注:在我的服务器指标。 php和facebook.php在同一个文件夹中。
喜托托,我有同样的问题。不过,我的不是一个画布页面。这只是在我的PHP文件。我可以知道你是如何解决它的?我曾要求用户在此之前的页面上登录Facebook。谢谢。 – davidlee 2010-12-28 08:02:11