'site/error'," statement in the config/main.php file to call it."/> 'site/error'," statement in the config/main.php file to call it.">

Home >PHP Framework >YII >How to define error page in yii2

How to define error page in yii2

尚
Original
2020-01-11 15:09:552427browse

How to define error page in yii2

Yii Framework is a component-based, high-performance PHP framework for developing large-scale web applications. Yii provides almost everything needed for today's Web 2.0 application development. Yii is one of the most efficient PHP frameworks.

In the Yii2 version of the advanced template environment: How to set up a 404 custom page:

1. config/main.php file

'errorHandler' => [
'errorAction' => 'site/error',
 ],

2. views/site /error.php

<?php
$this->context->layout = false; //不使用布局,或者改为自己所需要使用的布局
?>
<div class="site-error">
    <h1>404</h1>
</div>

Recommended learning: Yii Getting Started Tutorial

The above is the detailed content of How to define error page in yii2. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn