ThinkPHP的404页面设定方式

来源:互联网 发布:什么软件可以看美股 编辑:程序博客网 时间:2024/06/06 01:14

ThinkPHP中,某一个模块或方法不存在时,自定义404页面的方法

1、在Action目录中新建一个文件名为EmptyAction.class.php的文件

2、代码:

<?phpclass EmptyAction extends Action{    //所请求的模块不存在时,默认执行的模块    public function index(){        header("HTTP/1.0 404 Not Found");//404状态码        $this->display("Common:404"); //显示自定义的404页面模版    }        function _empty(){        header("HTTP/1.0 404 Not Found");//404状态码        $this->display("Common:404");//显示自定义的404页面模版    }}?>


0 1
原创粉丝点击