This article mainly introduced the thinkphp 404 Page setting method, needs the friend to be possible to refer to under
In many sites will have to use 404 pages, in the thinkphp framework of how to set it, and then I introduce one of the methods
1, first of all, under the lib/action to establish EmptyAction.class.php module
The contents are as follows:
The code is as follows:
<?php
/*
* @author Rocky
* @date 20141021
* @desc Empty module 404 error
* */
Class Emptyaction extends Commonaction {
function _empty () {
Header ("http/1.0 404 Not Found");
$this->display (' public:404 ');
}
}
?>
2, finish the above processing, only access to the empty module will only visit 404 pages, So, in order to access the Null method also access to 404 pages, we also need to add an empty method in CommonAction.class.php, the following methods:
The code is as follows:
Handle all the methods that are not in process, and boot to page 404
Public Function _empty () {
R (' Empty/_empty ');
}
3, finish the above work basically can, but don't forget to put your 404.html page under Tpl/public
This is OK, OK, collect the team! ~~~