问题
I have my signup controller code.
public function actionSignup()
{
$model = new SignupForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($user = $model->signup()) {
$this->layout = 'index';
return $this->goHome();
}
}
$this->layout = 'index';
return $this->render('signup', [
'model' => $model,
]);
}
When i, through url pass the address as index.php?r=site/login then there appears login form & that works fine. But when i pass as index.php?r=site/signup then it shows me above error. I am not getting this....
回答1:
Signup action is for guests, you get this 403 error because you are already authenticated.
来源:https://stackoverflow.com/questions/27380297/yii2-signup-page-shows-error-403-forbidden-you-are-not-allowed-to-access-the-p