我想通过last_name
小部件登录我的网站时向用户显示Facebook
和public function actions() {
return [
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'oAuthSuccess'],
],
];
}
public function oAuthSuccess($client) {
// get user data from client
$userAttributes = $client->getUserAttributes();
return $this->render('say', [
'first_name' => $userAttributes['first_name'],
'last_name' => $userAttributes['last_name'],
]);
// do some thing with user data. for example with $userAttributes['email']
}
。但是,当我没有记录任何事情时,我只看到我的索引页面。
我的控制器:
<?php
use yii\helpers\Html;
?>
<?= Html::encode($first_name) ?>
<?= Html::encode($last_name) ?>
我的观点say.php:
<b>