Home>Article>PHP Framework> How to create a 404 jump page in Thinkphp

How to create a 404 jump page in Thinkphp

angryTom
angryTom forward
2020-03-27 13:32:55 3342browse

This article introduces how to use ThinkPHP to implement a 404 page. I hope it will be helpful to friends who are learning thinkphp!

How to create a 404 jump page in Thinkphp

How to create a 404 redirect page in Thinkphp

There are many thinkphp 404 page creation methods on the Internet, but most of them are too cumbersome. It's simple, but it's annoying, so I'm sharing with you the most convenient way to make 404, as follows.
Add configuration items to the config configuration file in the public directory of thinkphp:

'TMPL_EXCEPTION_FILE' => 'Public/404.html',

Create 404.html in the Public folder with the following content

    404哟   

404

该页面不存在(′?ω?`)5秒后跳转到首页

This is done, as for the status code Of course it's 404, because thinkphp returns 404 by default for pages that don't exist, and you're done!

(Recommended tutorial:thinkphp tutorial)

The above is the detailed content of How to create a 404 jump page in Thinkphp. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete