久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

必須使用活動訪問令牌來查詢有關當前用戶的信

An active access token must be used to query information about the current user(必須使用活動訪問令牌來查詢有關當前用戶的信息)
本文介紹了必須使用活動訪問令牌來查詢有關當前用戶的信息的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在使用簡單代碼時不斷收到標題中的錯誤:

I keep getting the error in the title, while using a simple code:

require_once('sdk/src/facebook.php');
require_once("AppInfo.php");
function idx(array $array, $key, $default = null) {
  return array_key_exists($key, $array) ? $array[$key] : $default;
}
function he($str) {
  return htmlentities($str, ENT_QUOTES, "UTF-8");
}
$facebook = new Facebook(array(
  'appId'  => AppInfo::appID(),
  'secret' => AppInfo::appSecret(),
  'sharedSession' => true,
  'trustForwarded' => true,
));

$arrayForJSON=array();
$user = $facebook->getUser();
$friends = idx($facebook->api('/me/friends'), 'data', array());
if ($friends) {
  $arrayForJSON['friends']=$friends;
}
print_r($friends);

我真的不知道如何解決它,我一直在stackoverflow上搜索并嘗試了很多答案

I really don't know how to solve it, I've been searching and trying many answers on stackoverflow

推薦答案

如果沒有重定向用戶到登錄鏈接,則需要檢查是否已經登錄

you need to check if already login if not redirect the user to login link

require '../src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => '191149314281714',
  'secret' => '73b67bf1c825fa47efae70a46c18906b',
));

// Get User ID
$user = $facebook->getUser();

// We may or may not have this data based on whether the user is logged in.
//
// If we have a $user id here, it means we know the user is logged into
// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
   // $user_profile = $facebook->api('/me');
   $friends = idx($facebook->api('/me/friends'), 'data', array());

  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

// Login or logout url will be needed depending on current user state.
if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl(array('scope'=>'offline_access'));
}

這篇關于必須使用活動訪問令牌來查詢有關當前用戶的信息的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 日韩成人 | 天堂一区二区三区四区 | 国产欧美精品一区二区三区 | 国产精品美女久久久久久免费 | 羞羞的视频在线看 | 国产免费观看一区 | 99久久99| 免费黄色片在线观看 | 一区二区三区四区五区在线视频 | 欧美mv日韩mv国产网站91进入 | 久久99网 | 看一级毛片视频 | 中文字幕一区二区三区乱码图片 | 午夜免费观看体验区 | 日韩av一区二区在线观看 | 视频在线观看亚洲 | 亚洲aⅴ一区二区 | 日韩免费视频一区二区 | 亚洲 中文 欧美 日韩 在线观看 | 日韩欧美三级在线 | 国产色婷婷久久99精品91 | 青青草视频免费观看 | 国产精品1区2区 | 台湾a级理论片在线观看 | 成人性视频免费网站 | 午夜精品一区二区三区在线观看 | 日韩视频国产 | 亚洲一区二区在线视频 | 精品av天堂毛片久久久借种 | 国产午夜精品久久久久免费视高清 | 国产精品久久久久久婷婷天堂 | 国产欧美精品一区二区色综合 | 永久av| 草草精品 | 亚洲精品1区2区3区 91免费看片 | 成人依人 | 国产xxx在线观看 | 国产精品国产自产拍高清 | 91精品国产综合久久婷婷香蕉 | 国产精品99视频 | 武道仙尊动漫在线观看 |