1

私はこのエラーを探していましたが、それが発生するのを防ぐものはまだ見つかりませんでした.問題は、それが時々しか発生せず、エラーのログに別のエラーが表示されることです.

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>');
   }


?>

だからここに私の質問があります.誰かが私をここで助けてくれることを願っています.

4

0 に答える 0