如果是thinkphp框架, 先配置config.php 404地址
'TMPL_EXCEPTION_FILE' => './Application/Home/View/Public/404.html'
CSS代码
html { background: #f7f7f7; } body { background: #fff; color: #333; font-family: "MicrosoftYaHei" , "微软雅黑" ,Verdana,Arial; margin: 2em auto 0 auto; width: 700px; padding: 1em 2em; -moz-border-radius: 11px; -khtml-border-radius: 11px; -webkit-border-radius: 11px; border-radius: 11px; border: 1px solid #dfdfdf; } a { color: #2583ad; text-decoration: none; } a:hover { color: #d54e21; } h1 { border-bottom: 1px solid #dadada; clear: both; color: #666; margin: 5px 0 5px 0; padding: 0; padding-bottom: 1px; text-align: center; } h2 { text-align: center; font-size: 30px; } p { text-align: center; font-size: 18px; } div { margin-bottom: 80px; } ul { width: 400px; margin: 0 auto; }
JS代码
function seconds_back() { if (all <= 0) { self.location = "http://www.sucaihuo.com"; } var obj = document.getElementById("seconds_back"); if (obj) obj.innerHTML = all + " 秒后"; all--; } var all = 9; if (all > 0) window.setInterval("seconds_back();", 1000);
HTML代码
<html> <head></head> <body> <h1 id="logo"> <a href="http://www.素材火.com"><img alt="素材火logo" src="http://localhost/sucai/Public/images/logo.jpg" /></a> </h1> <h2> <img src="http://www.素材火.com/Public/images/err404.gif" alt="404错误" /> Hey? 404 </h2> <p>抱歉,你输入的网址可能不正确,或者该网页不存在。</p> <div> <ul> <li><a href="http://www.素材火.com"><span id="seconds_back"></span>返回首页</a></li> </ul> </div> </body> </html>