Php 访问用户令牌OAutheException时出错:必须使用活动访问令牌查询有关当前用户的信息
我一直在寻找这个错误,但我仍然没有找到任何可以阻止它发生的东西,问题是它只是偶尔发生,而且我的错误日志上还有另一个错误Php 访问用户令牌OAutheException时出错:必须使用活动访问令牌查询有关当前用户的信息,php,facebook,oauth,facebook-php-sdk,Php,Facebook,Oauth,Facebook Php Sdk,我一直在寻找这个错误,但我仍然没有找到任何可以阻止它发生的东西,问题是它只是偶尔发生,而且我的错误日志上还有另一个错误 There exists a cookie that we wanted to clear that we couldn't clear because headers was already sent. Make sure to do the first API call before outputing anything PHP Fatal error: Uncaught
There exists a cookie that we wanted to clear that we couldn't clear because headers was already sent. Make sure to do the first API call before outputing anything
PHP Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /...fb_sdk/base_facebook.php on line 1106
下面是我在config.php上使用的代码,我在我的应用程序的所有页面上都使用了它
<?php
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
require 'fb_sdk/facebook.php';
$app_id = 'XXXXXXXXXXXX';
$app_secret = 'XXXXXXXXXXXX';
$app_namespace = 'minstagram';
$app_url = 'https://apps.facebook.com/' . $app_namespace . '/';
$scope = 'email,publish_actions,user_photos,friends_photos';
// Init the Facebook SDK
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
// Get the current user
$user = $facebook->getUser();
// If the user has not installed the app, redirect them to the Auth Dialog
if (!$user) {
$loginUrl = $facebook->getLoginUrl(array(
'scope' => $scope,
'redirect_uri' => $app_url,
));
print('<script> top.location.href=\'' . $loginUrl . '\'</script>');
}
?>
所以这里是我的问题,希望任何人都能帮我,如果我现在拥有的密码无效,或者其他任何东西,也许能找到一种新的密码 您是否已调试以确保在调用标头或cookie之前未发送任何输出?输出缓冲解决问题了吗?@ClancyHood你好,我正在学习PHP如何调试它?我现在知道的唯一方法就是错误日志,这里是在任何输出(如echo)之前必须发送我的应用程序标题-在代码的不同阶段尝试以下操作:ifheaders\u sent$file,$line dieOutput在$line上的$file中启动;谁能解决这个问题?我也明白了。确切的问题发布在