thinkphp 404 Page Setup Method _php Tutorial

Source: Internet
Author: User

thinkphp 404 Page Setup method


This article mainly describes the thinkphp 404 Page Setup method, the need for friends can refer to the following

In many web sites will have 404 pages, how to set in the thinkphp framework, then I introduce one of the methods

1, the first to establish a EmptyAction.class.php module under the Lib/action
The contents are as follows:

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, finish the above processing, only access to the empty module when access to 404 pages, so, in order to access the empty method also access to 404 pages, we also need to add an empty method in CommonAction.class.php, the method is as follows:

The code is as follows:


Handle all methods that are not in the process, booting 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 will be OK, OK, take the team to collect the team! ~~~

http://www.bkjia.com/PHPjc/971930.html www.bkjia.com true http://www.bkjia.com/PHPjc/971930.html techarticle thinkphp 404 Page Setup Method This article mainly introduces the thinkphp 404 page of the setting method, the need for friends can refer to the following in many sites will have the use of 404 pages, in ...

  • Related Article

    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.