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! ~~~
http://www.bkjia.com/PHPjc/942985.htmlwww.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...