Home > php教程 > php手册 > body text

在thinkphp框架中添加404页面的方法

WBOY
Release: 2016-06-07 11:44:28
Original
1146 people have browsed it

在thinkphp框架中添加404页面的方法
第一步:

在Lib/Action文件夹下创建EmptyAction.class.PHP<?php <br /> class EmptyAction extends Action{<br>     function _empty(){<br>         header("HTTP/1.0 404 Not Found");//使HTTP返回404状态码<br>         $this->display("Public:404");<br>     }<br>     <br>     function index() {<br>         header("HTTP/1.0 404 Not Found");<br>         $this->display('Public:404');<br>     }<br> }<br> ?>第二步:

修改Lib/Action文件夹下所有的Action文件,在所有的控制器文件中加入如下代码:function _empty(){<br>     header("HTTP/1.0 404 Not Found");//使HTTP返回404状态码<br>     $this->display("Public:404");<br> }第三步,

在Tpl/Public文件夹下创建404页面404.html

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template