$facebook->getUser() 在转移到新主机后返回 0

发布于 2024-12-14 19:13:30 字数 286 浏览 3 评论 0原文

我正在使用 Facebook PHP SDK 3.1.1。这段代码在我以前的主机上运行得很好。我刚刚将其移至 BlueHost,即使用户已经登录,$user 的值也始终为 0:

$facebook = new Facebook(array(
  'appId'  => FACEBOOK_APIKEY,
  'secret' => FACEBOOK_SECRET_KEY,
));

$user = $facebook->getUser();

知道为什么会发生这种情况吗?

I'm using Facebook PHP SDK 3.1.1. This code works fine for me on my previous hosting. I've just moved it to BlueHost and the value of $user is always 0 even when user already logged in:

$facebook = new Facebook(array(
  'appId'  => FACEBOOK_APIKEY,
  'secret' => FACEBOOK_SECRET_KEY,
));

$user = $facebook->getUser();

Any idea why this can happen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忘羡 2024-12-21 19:13:30

getUser() 函数使用 $_REQUEST['signed_request']) 全局变量。

由于您说您最近切换了托管帐户,因此服务器可能配置为关闭 $_REQUEST 或以某种方式覆盖它。

您可以检查这些 php.ini 变量,因为它们会影响 $_REQUEST

  • variables_order
  • request_order

看到这些变量在您的模板中执行 phpinfo(); ,它将打印出来所有必要的信息。

http://php.net/manual/en/function.phpinfo.php

否则,您可能需要联系您的托管提供商并询问 $_REQUEST 全局变量,看看是否可以使用它。

The getUser() function uses the $_REQUEST['signed_request']) global.

And since you said you recently switched hosting accounts, it is possible that the server is configured either to turn off $_REQUEST or somehow override it.

You can check these php.ini variables, because they affect $_REQUEST:

  • variables_order
  • request_order

The see these variables do phpinfo(); in your template, which is going to print out all the necessary information.

http://php.net/manual/en/function.phpinfo.php

Otherwise, you might need to contact your hosting provider and ask about the $_REQUEST global, to see if you can use it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文