運行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