ThinkPHP自定义404页面

来源:互联网 发布:建筑学软件 编辑:程序博客网 时间:2024/05/17 05:04

在home
下controller里
建立EmptyController.class.php

代码:

<?php namespace Home\Controller;use Think\Controller;class EmptyController extends Controller{    function _empty(){        header("HTTP/1.0 404 Not Found");//使HTTP返回404状态码        $this->display("Public:404");    }    function index() {        header("HTTP/1.0 404 Not Found");        $this->display("Public:404");    }}

404.html代码

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>页面不存在,跳转中</title></head><body><script language="JavaScript" type="text/javascript">    window.location.href="__APP__";</script></body></html>

本文地址:http://liuyanzhao.com/3553.html

转载请注明

0 0