对不起,我是PHP的菜鸟,我想问一个非常基本的问题。无论如何一个找不到答案。我试图询问Facebook是否有人喜欢Facebook页面。我在SDK中看到它已经完成了这段代码:
$request = new FacebookRequest(
$session,
'GET',
'/me/likes/<page_id'
);
但是当我尝试这样做时,我收到以下错误:
PHP致命错误:第161行(...)/ Facebook / FacebookRequest.php中找不到“Facebook \ HttpClients \ FacebookStreamHttpClient”类
听起来像Facebook / HttpClients / FacebookStreamHttpClient未加载。无论如何,我认为它应该由acebook / FacebookRequest加载,不是吗?
我已经加载了以下文件:
require_once( 'Facebook/FacebookSession.php' );
require_once( 'Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'Facebook/FacebookRequest.php' );
require_once( 'Facebook/FacebookResponse.php' );
require_once( 'Facebook/FacebookSDKException.php' );
require_once( 'Facebook/FacebookRequestException.php' );
require_once( 'Facebook/FacebookAuthorizationException.php' );
require_once( 'Facebook/GraphObject.php' );
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
答案 0 :(得分:0)
您需要确保在代码中包含这些类:
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;