Answer the question
In order to leave comments, you need to log in
How to change error title in yii?
For error 404, the name of the error is "Not Found"(#404)" , for other errors, the name is also in English. At the same time, the error message is in Russian. Is it possible to change this without changing a lot of code?
Answer the question
In order to leave comments, you need to log in
Good afternoon.
In the error.php file, you can use the $exception variable and use it to change the title of the error page.
It looks like this:
if($exception->statusCode == 404){$this->title = 'Где-то ошибка';}
/* остальной код файла */
When you throw an error, write whatever you want in it.
throw new \yii\web\NotFoundHttpException("Тут пишу что хочу", 404);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question