실행 example code for the Facebook API null 세션 객체가 생기고 코드에 주석을 제공하는 null이 아닌 객체를 가져와야합니다. 내가 뭘 잘못 했니? 즉
, 내 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는 같은 폴더에 있습니다.
인사를