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