ThinkPHP404 page setting method. ThinkPHP404 page setting method this article mainly introduces the ThinkPHP404 page setting method. For more information, see how to set ThinkPHP 404 page when 404 pages are used in many websites.
This article describes how to set ThinkPHP 404 pages. For more information, see
How can I set the 404 page in the ThinkPHP framework for many websites? 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: Error of empty module 404
**/
Class EmptyAction extends CommonAction {
Function _ empty (){
Header ("HTTP/1.0 404 Not Found ");
$ This-> display ('public: 404 ');
}
}
?>
2. after completing the above processing, we can only access the 404 page when accessing the empty module. therefore, to access the 404 page for the empty method, we also need to go to CommonAction. class. add an empty method for php as follows:
The code is as follows:
// Process all the methods that do not exist and direct them to the 404 page
Public function _ empty (){
R ('empty'/_ empty ');
}
3rd, you can complete the work, but do not forget to put your 404.html page under Tpl/Public
In this case, OK. All right, close the team !~~~
Http://www.bkjia.com/PHPjc/971930.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/971930.htmlTechArticleThinkPHP 404 page setting method this article mainly introduced ThinkPHP 404 page setting method, need a friend can refer to in many websites will use 404 page, in...