错误:在 facebook PHP SDK 中找不到“FacebookFacebookSession"类 [英] Error: Class 'FacebookFacebookSession' not found with the facebook PHP SDK
问题描述
我在使用 facebook 的 SDK 文档时遇到了困难.我从 Github 下载了 SDK 并将其添加到我的 PHP 项目中.
I am having a hard time with facebook's SDK documentation. I downloaded the SDK from Github and added it into my PHP project.
这是文件系统:
├── Facebook
│ ├── FacebookAuthorizationException.php
│ ├── FacebookCanvasLoginHelper.php
│ ├── FacebookClientException.php
│ ├── FacebookJavaScriptLoginHelper.php
│ ├── FacebookOtherException.php
│ ├── FacebookPermissionException.php
│ ├── FacebookRedirectLoginHelper.php
│ ├── FacebookRequest.php
│ ├── FacebookRequestException.php
│ ├── FacebookResponse.php
│ ├── FacebookSDKException.php
│ ├── FacebookServerException.php
│ ├── FacebookSession.php
│ ├── FacebookThrottleException.php
│ ├── GraphLocation.php
│ ├── GraphObject.php
│ ├── GraphSessionInfo.php
│ ├── GraphUser.php
│ └── fb_ca_chain_bundle.crt
└── test.php
这是我目前的代码:
use FacebookFacebookSession;
use FacebookFacebookRequest;
use FacebookGraphUser;
use FacebookFacebookRequestException;
FacebookSession::setDefaultApplication('*******','******');
$helper = new FacebookRedirectLoginHelper('http://isgeek.eu/fb/FaRepost/return.php');
$loginUrl = $helper->getLoginUrl();
// Use the login url on a link or button to redirect to Facebook for authentication
我收到此错误
Fatal error: Class 'FacebookFacebookSession' not found in /homepages/2/d184071366/htdocs/isgeek/fb/FaRepost/test.php on line 9
更新了我的 PHP 版本,所以问题不是来自这里.好像没有找到 PHP 文件.我读了这个问题(Facebook SDK v4 for PHP Minimal Example)但是它没有帮助.
At updated my PHP version, so the issue does not comme from here. It seems like the PHP files are not found. I read this question (Facebook SDK v4 for PHP Minimal Example) but it does not help.
这是从哪里来的?
推荐答案
我找到了解决方案 这里
我已经有一段时间没有在 php 中编写代码了,但情况已经发生了变化.使用 FacebookFacebookSession;
是不够的.您还需要添加 require_once
.
I did not code in php for some time now and things have changed. use FacebookFacebookSession;
is not enough. You need to add a require_once
too.
require_once( 'Facebook/FacebookSession.php' );
有关更详细的解决方案,请查看下面的答案.
for a more detailed solution, please checkout the answer below.
这篇关于错误:在 facebook PHP SDK 中找不到“FacebookFacebookSession"类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!