Thinkphp framework 404 page settings, thinkphp404. In the thinkphp framework, the 404 page is set. the thinkphp408244 page is an error message optimized when the system cannot find the requested operation method and the requested controller name. Step 1: Set the thinkphp 404 page under the thinkphp framework, thinkphp404
The 404 page is an error message optimized when the system cannot find the requested operation method or the requested controller name.
Step 1: Create an EmptyController. class. php instance in the Home/comtroler of the thinkphp framework. the code is as follows:
Namespace Home \ Controller;
Use Think \ Controller;
Class EmptyController extends Controller {
// Empty operation_empty () method
Function _ empty (){
Header ("HTTP/1.0 404 Not Found ");
$ This-> displayed ("Public: 404 ");
}
Function index (){
Header ("HTTP/1.0 404 Not Found ");
$ This-> dislay ("Public: 404 ");
}
}
?>
Note: the header ("HTTP/1.0 404 Not Found") indicates that this status code is Not 404.
Step 2: create a public class PublicController. class. php in the Home/Comtroller of the thinkphp framework. the code is as follows:
Note: in the header ("Location:/bbs/thinkphp/404.html"),/bbs/thinkphp/404.html is the address of your 404th webpage. it must correspond to the Location of your 404.html page.
Step 3: let all other controllers inherit the PublicController. class. php in step 2, for example:
Note: comment out use Think \ Controller;
(Complete)
The lifecycle 404 page is an error message optimized when the system cannot find the requested operation method or the requested controller name. Step 1...