Facebook 使用 php 获取页面 ID 问题

发布于 2024-12-22 18:39:59 字数 1126 浏览 6 评论 0原文

我有一个 Facebook 应用程序和一个链接 http://localhost/a/index.php 的标签页,我已成功将此标签页添加到我的 pages 中。我在index.php中写道,

$checkLoggedIn = $facebook->getSignedRequest();

它像这样返回我,这

Array
(
[algorithm] => HMAC-SHA256
[expires] => 1324648800
[issued_at] => 1324644411
[oauth_token] => AAACMkfuFjmIBAEJ9zqtJVvDK08aXlO1wSEFVNvekyCWcZBtnQcJ8BTCYfwZBMyrom5nazjPCsF56v4hLCBi2VywUzgrLSTYr9sbMmTWDN5QFFeOBfU
[page] => Array
    (
        [id] => 309081639123289
        [liked] => 1
        [admin] => 1
    )

[user] => Array
    (
        [country] => bd
        [locale] => en_US
        [age] => Array
            (
                [min] => 21
            )

    )

[user_id] => 1549070809
)

对我来说没问题。我在该页面上还有另一个链接 start.php ,具有相同的代码,但它像这样返回给我,

Array
(
[algorithm] => HMAC-SHA256
[code] => 2.AQAHgyMnInvOgkoU.3600.1324648800.5-1549070809|OMFOQPTFesejPmg0h2SfwwNGGEY
[issued_at] => 1324644436
[user_id] => 1549070809
)

我现在可以做什么?获得相同的对象。因为它们在同一个 iframe 中。

I have a facebook application and a tab page which links http://localhost/a/index.php, I have successfully add this tab page to my pages. I wrote in index.php

$checkLoggedIn = $facebook->getSignedRequest();

it return me like this

Array
(
[algorithm] => HMAC-SHA256
[expires] => 1324648800
[issued_at] => 1324644411
[oauth_token] => AAACMkfuFjmIBAEJ9zqtJVvDK08aXlO1wSEFVNvekyCWcZBtnQcJ8BTCYfwZBMyrom5nazjPCsF56v4hLCBi2VywUzgrLSTYr9sbMmTWDN5QFFeOBfU
[page] => Array
    (
        [id] => 309081639123289
        [liked] => 1
        [admin] => 1
    )

[user] => Array
    (
        [country] => bd
        [locale] => en_US
        [age] => Array
            (
                [min] => 21
            )

    )

[user_id] => 1549070809
)

its ok for me. I have also another link on that page is start.php with same code but it return to me like this

Array
(
[algorithm] => HMAC-SHA256
[code] => 2.AQAHgyMnInvOgkoU.3600.1324648800.5-1549070809|OMFOQPTFesejPmg0h2SfwwNGGEY
[issued_at] => 1324644436
[user_id] => 1549070809
)

what can I now? to get same object. because they are in same iframe.

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

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

发布评论

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

评论(1

鹤仙姿 2024-12-29 18:39:59

这是因为 facebook sdk 仅在会话(您的第二个数组)中保存一些信息。要记住该页面,您必须手动保存它。

This is because the facebook sdk only saves some information in the session (your second array). To remember the page, you have to manually save it.

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