All website projects need to add a 404 page, which is not only friendly, but also has some benefits for website optimization. The method of adding a 404 page to a website built using the ThinkPHP framework is still very simple, empty classes and empty methods are used.
Step 1:
Create EmptyAction. class. PHP In the Lib/Action folder
<?phpclass EmptyAction extends Action {function _empty(){header("HTTP/1.0 404 Not Found");$this->display('empty:index');}// 404function index() {header("HTTP/1.0 404 Not Found");$this->display('empty:index');}}
Step 2:
Modify all Action files in the Lib/Action folder and add the following code to all controller files:
function _empty(){header("HTTP/1.0 404 Not Found");$this->display('empty:index');}
Step 3,
Create page index.html under the Tpl/emptyfolder
If someone guesses the ThinkPHP framework you are using, they may find some Vulnerabilities Based on the ThinkPHP access method (it seems that some new PHP users like this)
To solve this problem, you can create a public class, including an empty class, which inherits this public class for determination.
Friends who like to discuss can join a group of 252799167
This article is from the "Thunder" blog, please be sure to keep this source http://a3147972.blog.51cto.com/2366547/1219682