donglue8180 2012-10-22 11:50
浏览 35
已采纳

使用Yii框架和facebook注册插件创建注册表单

I am using a facebook registration plugin to register users if they have a facebook account or using the default registration form if they don't have a fb account.

I have created the default registration form in yii framework storing data using model into database.

I have also written code to use facebook registration plugin using iframe.

The problem is that how to save the data in database filled in fb registration plugin form and what to mention in redirect-uri ?

  • 写回答

1条回答 默认 最新

  • dseslyh6662605 2012-10-22 14:34
    关注

    After facebook has authenticated the user, and given permission to your application, you can get the user data using the facebook sdk (either php or js) by calling the api method "/me".

    example using the php sdk:

    $user = $facebook->getUser();
    if ($user) {
      try {
        $user_profile = $facebook->api('/me');
        //Now using the the facebook data we create 'our' user
        $model = new User;
        $model->username = $user_profile['fullname'];
        //and so on..
        $model->save();
      } catch (FacebookApiException $e) {
        error_log($e);
        $user = null;
      }
    }
    

    more details in the oficial php sdk repo

    The return URL must point to your application's page, the one you configured when you created the application on facebook

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 深度学习残差模块模型
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)