tp5 404页面配置信息

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Jack_num1/article/details/79894139
在application文件夹下config.php配置文件
1、// 关闭应用调试模式
     'app_debug'              => false,
2、// 异常页面的模板文件
    'exception_tmpl'         => APP_PATH.'404.html',
、在application文件夹下创建404.html页面
1.代码如下
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="robots" content="noindex,follow">
    <title>页面不存在</title>
    <link rel="stylesheet" href="http://www.xtuan.com/css/404.css" type="text/css" />
    <style>
        body {
            font-family: Arial,Helvetica,sans-serif;
            font-size: 12px;
            color: #000;
            min-width: 980px;
        }
        * {
            margin: 0px 0px;
            padding: 0px 0px;
        }
        .found-logo {
            width: 1000px;
            margin: 30px auto 0;
        }
        a:visited {
            text-decoration: none;
            color: #fff;
        }
        a:link {
            text-decoration: none;
            color: #fff;
        }
        img {
            border: none;
            vertical-align: middle;
        }
        .not-found {
            width: 1000px;
            margin: 0 auto;
            font-family: "微软雅黑","Microsoft YaHei",arial,"宋体";
            padding-top: 46px;
        }
        .clear {
            clear: both;
        }
        .not-found .pic {
            background: url("/static/images/404.png") no-repeat center;
            width: 400px;
            height: 180px;
            margin: 0 auto;
        }
        .not-found .info {
            width: 400px;
            margin: 0 auto;
        }
        .not-found .info h5 {
            font-weight: normal;
            font-size: 26px;
            color: #333;
            margin: 26px 0;
        }
        .not-found .info p {
            font-size: 14px;
            color: #666;
            line-height: 26px;
        }
    </style>
</head>
<body>
<div class="found-logo"><a href="http://www.cctv.com" title="CCTV"><img style="width: 200px;" src="/static/index/img/logo/LOGO.png" alt=""></a></div>
<div class="not-found clear">
    <div class="pic"></div>
    <div class="info">
        <h5>抱歉,你所访问的页面不存在了!</h5>
        <p>您可以尝试:</p>
        <p>1. 检查输入的网址,或者返回<a href="javascript:history.go(-1);">上一页</a></p>
        <p>2. 快速进入<a href="http://www.cctv.com">首页</a></p>
    </div>
</div>
</body>
</html>

2、图片放置位置:public/static/自定义文件夹名/图片

注意:当在开发阶段,请打开config.php中的应用调试,方便查看错误信息。
但为了安全性,当项目上线时请关闭调试模式。

猜你喜欢

转载自blog.csdn.net/Jack_num1/article/details/79894139