进一步的Facebook登录Javascript错误 [英] Further Facebook Login Javascript Errors

查看:101
本文介绍了进一步的Facebook登录Javascript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我以前的问题的延伸。有些解决,我仍然遇到错误。我正在使用Javascript指南 here 。我现在在页面的最后一个代码段,朝向底部。在我的页面顶部,我的代码中定义了以下代码( APP ID SECRET ID ):

 <?php 

define('YOUR_APP_ID','** APP ID **');
define('YOUR_APP_SECRET','** SECRET ID **');

函数get_facebook_cookie($ app_id,$ app_secret){
$ args = array();
parse_str($ _ COOKIE ['fbs_'。$ app_id],'\\''),$ args);
ksort($ args);
$ payload = ';
foreach($ args as $ key => $ value){
if($ key!='sig'){
$ payload。= $ key。'='。 $ value;
}
}
if(md5($ payload。$ app_secret)!= $ args ['sig']){
return null;
}
return $ args;
}

$ cookie = get_facebook_cookie(YOUR_APP_ID,YOUR_APP_SECRET);

$ user = json_decode(file_get_contents(
'https://graph.facebook.com/me?access_token='
$ cookie ['access_token']));

?>
再次,我的应用程序ID正确显示在错误代码中。

 注意:未定义的索引:fbs _ ** MY C中的APP ID **:\wamp\www\_header.php第10行
注意:未定义的索引:sig在C:\wamp在线18上的\\www\_header.php

是否可能是与WAMP相关的问题?感谢提前。

解决方案

检查你的括号。很多时候,支架层次结构之间的简单混淆可以解决这些令人讨厌的错误。


This is kinda an extension of my previous question. With that somewhat resolved, I'm still encountering errors. I'm working off of the Javascript guide here. I'm now on the last code segment of the page, towards the bottom. At the top of my page, I have the following code (APP ID and SECRET ID are defined in my code):

<?php

define('YOUR_APP_ID', '**APP ID**');
define('YOUR_APP_SECRET', '**SECRET ID**');

function get_facebook_cookie($app_id, $app_secret) {
  $args = array();
  parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
  ksort($args);
  $payload = '';
  foreach ($args as $key => $value) {
    if ($key != 'sig') {
      $payload .= $key . '=' . $value;
    }
  }
  if (md5($payload . $app_secret) != $args['sig']) {
    return null;
  }
  return $args;
}

$cookie = get_facebook_cookie(YOUR_APP_ID, YOUR_APP_SECRET);

$user = json_decode(file_get_contents(
    'https://graph.facebook.com/me?access_token=' .
    $cookie['access_token']));

?>

But now I get these errors (googling them hasn't turned anything useful up):

Again, my app id IS shown in the error code correctly.

Notice: Undefined index: fbs_**MY APP ID** in C:\wamp\www\_header.php on line 10
Notice: Undefined index: sig in C:\wamp\www\_header.php on line 18

Is it possible it could be a problem associated with WAMP? Thanks in advance.

解决方案

Check your brackets. A lot of times simple confusion among bracket hierarchies can fix these obnoxious errors.

这篇关于进一步的Facebook登录Javascript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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