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 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看