zoukankan      html  css  js  c++  java
  • thinkphp 取消错误信息,跳转404.html

    用户在导航栏中输入错的的地址,页面会出现错误信息。不想显示错误信息,用户在导航栏输错的时候,直接跳转404.html页面,如下步骤:

    在Common->Conf->config.php中添加

    'TMPL_EXCEPTION_FILE'   =>  './404.html',// 异常页面的模板文件
    'ERROR_PAGE'            =>  './404.html', // 错误定向页面

    即可,然后在根目录添加404.html文件

    404.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>404页面错误</title>
        <style>
            #wei{ margin: 130px auto 0px 0px;height: 100px; width: 100%;text-align: center; font-size: 24px;text-shadow: 1px 1px 0 #CCC, 2px 2px 0 #CCC, /* end of 2 level deep grey shadow */ 3px 3px 0 #444, 4px 4px 0 #444, 5px 5px 0 #444, 6px 6px 0 #444; /* end of 4 level deep dark shadow */  }
            #wei { cursor: pointer; }
            a{ display: block; height: 50px; width: 100%; text-align: center;}
        </style>
    </head>
    <body>
        <div id="wei"></div>
        <a href="/Robotsgroup/index">点击返回“首页”>></a>
        <script>
            var c=document.getElementById("wei");
            c.innerHTML="404,未找到"+window.location.pathname+"页面";
        </script>
    </body>
    </html>

    然后在导航栏随意输入地址时,显示页面为:

  • 相关阅读:
    day01-h1字体大小和文本居中
    js正则表达式中的
    js滚动分页原理
    在web.xml中设置全局编码
    C# 导出word 表格代码
    C# 创建单例
    Winform 异步调用2 时间
    Winform 异步调用
    c#中跨线程调用windows窗体控件
    C# 中的委托和事件
  • 原文地址:https://www.cnblogs.com/wsw8384/p/8953392.html
Copyright © 2011-2022 走看看