2
我想登入前端和後端不同的憑據,從不同的表,所以我現在有不同的形式,模式,規則,等等Yii2 stateKeyPrefix的前端和後端登錄
我tryed設置作爲Yii有stateKeyPrefix
,但它不起作用。
任何人都知道如何登錄我想怎麼樣?
以下方法返回true,因爲我已經在前端記錄n;在會話組件
'user'=>array(
'stateKeyPrefix'=>'yourDifferentPrefixForEveryDomain',
...
),
而且不同的SESSIONNAME:
public function actionLogin() {
if (!\Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new LoginAdminForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
return $this->render('login', [
'model' => $model,
]);
}
}