Facebook SDK 粉丝页面应用程序问题
在过去的几天里,我一直在构建一个新的 Facebook 应用程序,该应用程序允许用户将 PHP CMS 添加到他们的粉丝页面,从而使他们无需任何设计或编程知识即可构建完整的“迷你网站”。
但是,当我尝试获取安装该应用程序的当前页面 ID 时,我什么也没得到。
我同时使用 HTTP 和 HTTPS,但我没有从它们中得到任何结果。
我尝试提取数据的代码是:
require "src/facebook.php";
$app_id = “MY APP ID”;
$app_secret = “MY APP SECRET”;
$facebook = new Facebook(array(‘appId’ => $app_id,
‘secret’ => $app_secret,
‘cookie’ => true));
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];
echo "<br>". $pageid;
echo "<br>". $page_admin;
echo "<br>". $like_status;
我收到这些错误消息:
Notice: Use of undefined constant “247517918644221” - assumed '“247517918644221”' in /home/hazvuv/hazvuvp.com/why/index.php on line 6
Notice: Use of undefined constant “d7750be2ef0934bea4e2e8fe65a42a2a” - assumed '“d7750be2ef0934bea4e2e8fe65a42a2a”' in /home/hazvuv/hazvuvp.com/why/index.php on line 7
Notice: Use of undefined constant ‘appId’ - assumed '‘appId’' in /home/hazvuv/hazvuvp.com/why/index.php on line 9
Notice: Use of undefined constant ‘secret’ - assumed '‘secret’' in /home/hazvuv/hazvuvp.com/why/index.php on line 10
Notice: Use of undefined constant ‘cookie’ - assumed '‘cookie’' in /home/hazvuv/hazvuvp.com/why/index.php on line 11
Notice: Undefined index: appId in /home/hazvuv/hazvuvp.com/why/src/base_facebook.php on line 213
Notice: Undefined index: secret in /home/hazvuv/hazvuvp.com/why/src/base_facebook.php on line 214
Notice: Undefined variable: pageid in /home/hazvuv/hazvuvp.com/why/index.php on line 22
我做错了什么?
In the last couple of days I've been building a new Facebook app that lets a user add a PHP CMS to their fan page that lets them build a full 'minisite' without any design or programming knowledge.
But, when I try to get the current page ID that the app is installed on, I don't get anything.
I'm using both HTTP and HTTPS, but I get nothing from either of them.
The code I'm trying to pull the data with is:
require "src/facebook.php";
$app_id = “MY APP ID”;
$app_secret = “MY APP SECRET”;
$facebook = new Facebook(array(‘appId’ => $app_id,
‘secret’ => $app_secret,
‘cookie’ => true));
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];
echo "<br>". $pageid;
echo "<br>". $page_admin;
echo "<br>". $like_status;
And im having these error messages:
Notice: Use of undefined constant “247517918644221” - assumed '“247517918644221”' in /home/hazvuv/hazvuvp.com/why/index.php on line 6
Notice: Use of undefined constant “d7750be2ef0934bea4e2e8fe65a42a2a” - assumed '“d7750be2ef0934bea4e2e8fe65a42a2a”' in /home/hazvuv/hazvuvp.com/why/index.php on line 7
Notice: Use of undefined constant ‘appId’ - assumed '‘appId’' in /home/hazvuv/hazvuvp.com/why/index.php on line 9
Notice: Use of undefined constant ‘secret’ - assumed '‘secret’' in /home/hazvuv/hazvuvp.com/why/index.php on line 10
Notice: Use of undefined constant ‘cookie’ - assumed '‘cookie’' in /home/hazvuv/hazvuvp.com/why/index.php on line 11
Notice: Undefined index: appId in /home/hazvuv/hazvuvp.com/why/src/base_facebook.php on line 213
Notice: Undefined index: secret in /home/hazvuv/hazvuvp.com/why/src/base_facebook.php on line 214
Notice: Undefined variable: pageid in /home/hazvuv/hazvuvp.com/why/index.php on line 22
What am i doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的脚本包含 unicode 引号和双引号,而 PHP 无法识别它们。请参阅 ' vs ' 和 ” vs "。很难区分,但它们是不同的。浏览一下代码,将 unicode 引号/双引号替换为从键盘手动输入的 ascii 引号。
Your script has unicode quotes and double quotes and PHP does not recognize them. See ‘ vs ' and ” vs ". It is hard to tell but they are different. Go through the code and replace the unicode quotes/double quotes with ascii quotes manually typed from you keyboard.
将引号 (“ ” ' ') 替换为常规引号(' 和 ")
replace quotations marks (“ ” ‘ ’) with regular quotes (' and ")