Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Sdk Facebook 4.0错误_Php_Facebook_Facebook Graph Api - Fatal编程技术网

PHP Sdk Facebook 4.0错误

PHP Sdk Facebook 4.0错误,php,facebook,facebook-graph-api,Php,Facebook,Facebook Graph Api,我已经安装了我的facebook sdk 4.0脚本,它运行良好。除了我有很多错误。当我修复彼此时,会显示另一个。我终于修补了所有的错误,我看到的只是这个?我看到的错误就是找不到类文件,所以我需要所需的文件。我使用的域位于我的system32 C:\windows\system32\drivers\etc\hosts中的My hosts文件中,我的网站页面上的所有即时消息如下所示 Facebook\GraphObject Object ( [backingData:protected] =>

我已经安装了我的facebook sdk 4.0脚本,它运行良好。除了我有很多错误。当我修复彼此时,会显示另一个。我终于修补了所有的错误,我看到的只是这个?我看到的错误就是找不到类文件,所以我需要所需的文件。我使用的域位于我的system32 C:\windows\system32\drivers\etc\hosts中的My hosts文件中,我的网站页面上的所有即时消息如下所示

Facebook\GraphObject Object ( [backingData:protected] => Array ( [id] => 397011563769936 [first_name] => Fernando [gender] => male [last_name] => Smith [link] => https://www.facebook.com/app_scoped_user_id/397011563769936/ [locale] => en_GB [name] => Fernando Smith [timezone] => 1 [updated_time] => 2014-05-17T01:35:48+0000 [verified] => 1 ) )
这是我的index.php,我所有的文件都是index.php和文件夹“Facebook”,里面有所有Facebook sdk文件。这是facebook提供的例子,所以他们不应该有任何问题

<?php
session_start();
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;

// init app with app id (APPID) and secret (SECRET)            
   FacebookSession::setDefaultApplication('***************','********************************');

// login helper with redirect_uri
$helper = new FacebookRedirectLoginHelper( 'http://iamawsome.com/fb/' );

try {
$session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
// When Facebook returns an error
} catch( Exception $ex ) {
// When validation fails or other local issues
}

// see if we have a session
if ( isset( $session ) ) {
// graph api request for user data
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
// get response
$graphObject = $response->getGraphObject();

// print data
echo  print_r( $graphObject, 1 );
} else {
// show login url
echo '<a href="' . $helper->getLoginUrl() . '">Login</a>';
}    
?>


您想做什么?你看到了什么错误?我已经在帖子里告诉你了。我正在尝试添加facebook登录。这都是在developers.facebook.com上设置的,就像我说的,所有的即时消息都是我在我的问题中输入的信息。如果这是你看到的唯一有效的东西。这就是脚本应该做的,它是有效的!您可以这样访问用户数据:
$graphObject->getProperty('first_name')