This article describes how to set ThinkPHP404 pages. For more information, see
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:
<? Php
/*
* @ 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 !~~~