我用作曲家自动加载了Facebook的sdk课程。这是作曲家autoload_psr4.php
:
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Facebook\\' => array($vendorDir . '/facebook/php-sdk-v4/src/Facebook'),
'Bolt\\Extension\\radix\\facebook\\' => array($baseDir . '/'),
);
在我的代码中,我正在使用各种类:
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookOtherException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphSessionInfo;
use Facebook\GraphUser;
class Extension extends BaseExtension
{
public function initialize() {
FacebookSession::setDefaultApplication('zzzz','zzzzzzz');
$session = new FacebookSession('zzzzz');
$this->app->get("test", function () use ($session){
$request = new FacebookRequest($session, 'GET', '/2342342342323432/events');
$response = $request->execute();
$graphObject = $response->getGraphObject();
$response = $this->app->json($graphObject);
return $response;
});
}
public function getName()
{
return "facebook";
}
}
但是我在击中那条路线时遇到了上述错误。该类肯定存在于自动加载的文件夹中,所以我不知道我在这里做错了什么。谁能摆脱光明?