thinkphp bottom Set jump 404 page

Source: Internet
Author: User

After the development of the project to block the error, in the bottom directory to write a 404 page, the entry file App_debug to False, the code uses the following methods
1. Using an empty operation, _empty (), when entering a controller, if the method is not found, call _empty directly, and then enter 404.
2. In TP, when initializing the project, there is a common~ under runtime Runtime.php, this is a cache file, which has most of the core files, loading empty modules or empty controller, automatically from this file to obtain relevant information, including loading empty modules and empty controller, is from this file to obtain information.
3. Loading empty module error message in thinkphp/think/dispatcher.class.php 178 lines
Code:
E (L ('module_not_exist'). ': '. MODULE_NAME);
In front of this, add
Header ("location:/404.html");d ie;
Specific page to write a can, 404 into the bottom directory
4. Load the empty controller (non-existent controller)
thinkphp/library/think/app.class.php102 Line
E (L ('controller_not_exist'). ': '. Controller_name);
Add 404 code above.

Finally delete all files from the runtime directory (just in case, simply delete common~runtime.php) and reload the page.
This will not be able to load the module or control information on the line, all is adjusted to 404.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

thinkphp bottom Set jump 404 page

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.