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 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题