-2
我試圖組合這兩個SDK。爲了做到這一點,我創建了這個代碼:Facebook Connect - JavaScript和PHP SDK
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>New JavaScript SDK & OAuth 2.0 based FBConnect Tutorial | Thinkdiff.net</title>
<!--
@author: Mahmud Ahsan (http://mahmud.thinkdiff.net)
-->
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
var button;
var userInfo;
window.fbAsyncInit = function() {
FB.init({ appId: 'xxxxxxxxxx', //change the appId to your appId
status: true,
cookie: true,
xfbml: true,
oauth: true});
showLoader(true);
</script>
<body>
<?php
$cookie = preg_replace("/^\"|\"$/i", "", $_COOKIE['fbs_' . "203222769784206"]);
parse_str($cookie, $data);
$fb = new Facebook(array(
'appId' => "xxxx",
'secret' => "xxxxxx"
));
$fb->setAccessToken($data['access_token']);
var_dump($fb->getUser());
?>
</body>
</html>
但是,它打印int(0)。可能是什麼問題?它錯在哪裏?訪問令牌有問題嗎?