dongsi5381 2014-06-14 12: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 14: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.

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

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化