Home > Backend Development > PHP Tutorial > How to set up ThinkPHP 404 page_PHP tutorial

How to set up ThinkPHP 404 page_PHP tutorial

WBOY
Release: 2016-07-13 10:01:41
Original
819 people have browsed it

How to set up ThinkPHP 404 page

This article mainly introduces how to set up ThinkPHP 404 page. Friends who need it can refer to it

When 404 pages are used in many websites, how to set them in the ThinkPHP framework? Next, I will introduce one of the methods

1. First, create the EmptyAction.class.php module under Lib/Action
The content is as follows:

The code is as follows:


/*
* @author rocky
* @date 20141021
* @desc Empty module 404 and other errors
* */
class EmptyAction extends CommonAction {
function _empty(){
header("HTTP/1.0 404 Not Found");
$this->display('Public:404');
}
}
?>

2. After completing the above processing, the 404 page can only be accessed when the empty module is accessed. Therefore, in order to access the empty method and the 404 page, we also need to add an empty method to CommonAction.class.php , the method is as follows:

The code is as follows:


//Processing methods for all unavailable methods, leading to the 404 page
public function _empty() {
R('Empty/_empty');
}

3. After completing the above work, it is basically OK, but don’t forget to put your 404.html page under Tpl/Public

That’s ok, okay, let’s close the team, close the team! ~~~

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/971930.htmlTechArticleHow to set up the ThinkPHP 404 page. This article mainly introduces how to set up the ThinkPHP 404 page. Friends who need it can refer to it. Next, many websites will use 404 pages, in...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template