How to set up ThinkPHP 404 page, thinkphp404_PHP tutorial

WBOY
Release: 2016-07-13 10:09:37
Original
826 people have browsed it

How to set up ThinkPHP 404 page, thinkphp404

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:

Copy code 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 access the 404 page, we also need to add an empty method to CommonAction.class.php , the method is as follows:

Copy code 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/942985.htmlTechArticleHow to set up ThinkPHP 404 page, thinkphp404 When 404 page is used in many websites, in the ThinkPHP framework How to set it up? Next I will introduce one of the methods...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!