thinkphp 404 Page Setup method

Source: Internet
Author: User
Tags html page

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! ~~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.