我的Facebook对象是空的 [英] My Facebook object is empty

查看:90
本文介绍了我的Facebook对象是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $ facebook = new Facebook(array(
' appId'=>'xxxx ..',
'secret'=>'xxx ...',
));

当我测试 $ facebook 我看到它没有任何属性。



我已经添加了Facebook的PHP文件。否则它应该抛出一个错误。所以链接库不是我的问题。



我已经检查了 appId 和密码,它们也是正确的。我不知道为什么Facebook对象是空的,它不会显示任何错误。



我正在使用最新版本的PHP SDK。我今天更新了我使用相同的应用程序通过Javascript Facebook SDK登录用户,所以我认为我的应用程序设置正确。

解决方案

我发现,我没有一个空的Facebook对象。我正在使用 Krumo 类来打印对象内容,并且可能设置为不显示protectec属性。当我使用PHP print_r函数时,我得到这个对象:


 Facebook对象(
[appId:protected] => xxx
[apiSecret:protected] => xxx
[user:protected] =>
[signedRequest:protected] =>
[state:protected] =>
[accessToken:protected] =>
[fileUploadSupport:protected] =>



I have very simple PHP code from Facebook tutorial:

$facebook = new Facebook(array(
  'appId'  => 'xxxx..',
  'secret' => 'xxx...', 
));

when I test the $facebook object, I see that it hasn't any properties.

I have included the Facebook PHP file. Otherwise it should throw an error. So linking libraries is not my problem.

I have checked appId and secret codes and they are correct too. I don't know why facebook object is ampty and it doesn't displays any error.

I am using the newest version of PHP SDK. I updated it just today. I am using the same application to log in the user by Javascript Facebook SDK, so I think, my application is set correctly.

解决方案

As I find out, I haven't an empty Facebook object. I am using Krumo class to print the object content and it is probably set not to display protectec attributes. When I use the PHP print_r function, I get this object:

Facebook Object (
  [appId:protected] => xxx
  [apiSecret:protected] => xxx
  [user:protected] =>
  [signedRequest:protected] =>
  [state:protected] =>
  [accessToken:protected] =>
  [fileUploadSupport:protected] =>
) 

这篇关于我的Facebook对象是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆