在过去的几天里,我一直在构建一个新的Facebook应用程序,让用户可以在他们的粉丝页面添加一个PHP CMS,让他们在没有任何设计或编程知识的情况下构建一个完整的“minisite”。
但是,当我尝试获取安装该应用程序的当前页面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
我做错了什么?
答案 0 :(得分:0)
您的脚本具有unicode引号和双引号,PHP无法识别它们。请参阅'vs'和“vs”。很难说它们是不同的。通过代码并将unicode引号/双引号替换为从键盘手动键入的ascii引号。
答案 1 :(得分:0)
用常规引号替换引号(“”“)(&#39;和&#34;)