dongsi5381 2014-06-14 04:27
浏览 45
已采纳

使用Facebook PHP SDK 4找不到“Facebook \ GraphObject”类

I want to connect my page with facebook and downloaded therefore the Facebook PHP SDK 4. Since the Facebook documentation and the GitHub page are not really well made, I have a question regarding my error message from the title.

I don't want to use Composer for PHP (which should be possible according to the Facebook documentation).

I followed the example on the Github page and included the Facebook PHP files into my PHP file with the following lines of code:

use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
require_once( 'Facebook/FacebookSession.php' );
require_once( 'Facebook/FacebookRequest.php' );
require_once( 'Facebook/GraphUser.php' );
require_once( 'Facebook/FacebookRequestException.php' );

In the documentation there is nowhere mentioned that I have to include the require_once statement, I found that on stackoverflow.

Problem is now that even with the above (correct) implementation, I get an error which says 'Fatal error: Class 'Facebook\GraphObject' not found in ../fblogin2/Facebook/GraphUser.php on line 33'

I think in this class there is also no require_once statement, but I can't go through the whole SDK code and add the statements for Facebook. Shouldn't it work out-of-the-box? Are there some good tutorials for the SDK 4 or anything else, because I'm really stuck with the official facebook documentation and the short github example.

  • 写回答

1条回答 默认 最新

  • doujiunai2169 2014-06-14 06:02
    关注

    Now I found a good tutorial and solution for the Facebook SDK (v4) here.

    It's 'funny' that a billion dollar company is not able to provide a decent documentation.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部