Empty operation and empty module is very useful, he has some similar to PHP virtual machine Custom 404 page, using this mechanism we can better implement the URL and error page optimization.
One. Empty module:
? Well understood, that is, when you do not have the module, thinkphp will automatically find the module, when the module is not found, thinkphp will automatically define the index method under the empty module.
<? PHP class extends controller{ publicfunction index () { echo ' <script> Window.location.href= ". /er/error "</script>";? }
? This is a simple empty module that can be developed according to the requirements of the project
Two. Empty operation:
Empty operation is, when you in the current module, the implementation of the module does not have a method, will automatically jump to _empty this method, and can be used in conjunction with the empty module.
For example, an empty operation is defined under the index module
<? PHP class indexcontroller extendx controller{ publicfunction index () {? Echo "Index function"; } Public function _empty () { echo ' <script>window.location.href= '. /er/error "</script>";? }?
OK, here it is! More complex will be specific to the concrete analysis of the matter!!
thinkphp Empty Operation Empty module