Answer the question
In order to leave comments, you need to log in
Yii2. How to create a feedback form on the error.php page (404 page)?
Good afternoon!
Please tell me how to connect the feedback form in yii2 for the error.php page?
For other pages (for example, the main one) I write in SiteController:
public function actionIndex() {
$model = new MyForm();
if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('contactFormSubmitted');
return $this->refresh();
}
return $this->render('index', [
'model' => $model,
]);
}
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
];
}
Answer the question
In order to leave comments, you need to log in
Actually disable the use of yii\web\ErrorAction as an error page and implement your own actionError method in the controller that will do everything you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question