2016-09-12 12:18:33 1680次浏览 0条回答 0 悬赏 15 金钱

数据库方面只需要在user表插入openid,还需要添加其他东西吗?2016-09-12_121605.png

补充于 2016-09-12 12:28

controller方向:

class SiteController extends Controller
{
    public function actions()
    {
        return [
            'auth' => [
                'class' => 'yii\authclient\AuthAction',
                'successCallback' => [$this, 'successCallback'],
            ],
        ]
    }

    public function successCallback($client)
    {
        $attributes = $client->getUserAttributes();
        // user login or signup comes here
    }
}

这里还需要添加什么东西吗?有句话 // user login or signup comes here,是把

public function actionLogin()
{
        $this->title = '用户登陆'.' - '.Yii::$app->name;
        $this->description = '';
        $this->canonical = Yii::$app->params['domain'].'login';

        if (!\Yii::$app->user->isGuest) {
            return $this->goHome();
        }
        $next = Yii::$app->request->get('next');
        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            if(isset($next)) return $this->redirect($next);
            return $this->goHome();
        } else {
            return $this->render('login', [
                'model' => $model,
            ]);
        }
    },

加到里面?

补充于 2016-09-12 12:48

新手等待大神中......

补充于 2016-09-16 00:03

事情证明,求人不如求解,解决了

    没有找到数据。
您需要登录后才可以回答。登录 | 立即注册
38039
等待激活

38039

注册时间:2016-10-31
最后登录:1970-01-01
在线时长:0小时0分
  • 粉丝3
  • 金钱5
  • 威望0
  • 积分5

热门问题