我使用Yii2框架,我必須獲得網絡服務Facebook好友列表,這個我按照這樣的步驟: FB FriendList獲取Facebook好友列表
試過這樣:
<?php
use yii\Facebook\Facebook; // facebook class
public function getFbUserListFB()
{
$fb = new Facebook([
'app_id' => 'appID',
'app_secret' => 'appSECRET',
'default_graph_version' => 'v2.3'
]);
$response = $fb->get('/me');
print_r($response);
}
?>
,但得到這個錯誤:
{
"name": "PHP Fatal Error",
"message": "Class 'yii\Facebook\Facebook' not found",
"code": 1,
"type": "yii\base\ErrorException",
"file": "/var/www/html/PROJECT/api/modules/v1/models/FILENAME.php",
"line": 19,
"stack-trace": [
"#0 [internal function]: yii\base\ErrorHandler->handleFatalError()",
"#1 {main}"
]
}
的Facebook SDK路徑是:
/var/www/html/PROJECTNAME/vendor/facebook/php-sdk-v4/src/Facebook/<all-files-and-folder>
爲什麼反對票? –