yii2 How to customize the error page: 1. Set the style of the error page in "views/site/error.php"; 2. In "config/main.php", modify the configuration file and use "'errorAction'=>'site/error'," statement is called.
In the advanced template environment of the Yii2 version, customize the 404 error page:
1, views/ site/error.php, set the error page style
<?php $this->context->layout = false; //不使用布局,或者改为自己所需要使用的布局 ?> <div class="site-error"> <h1>404错误</h1> </div>
2. Modify the application configuration file: config/main.php
'errorHandler' => [ 'errorAction' => 'site/error', ],
related Recommended article tutorials: "yii Framework Tutorial", "PHP Tutorial"
The above is the detailed content of How to customize error page in yii2?. For more information, please follow other related articles on the PHP Chinese website!