简介
由于默认的404页面真的难看,于是我在子比社区中发现了分享一个仿Windows蓝屏的404页面-建站综合交流社区-WordPress-WordPress主题模板-zibll子比主题文章,写的非常好,可是他是HTML,我转化了一下PHP格式,然后才出来的效果
效果图
代码部署
把代码放在子比根目录-404.php
中
<?php
echo "<!DOCTYPE html>\n";
echo " <meta charset=\"utf-8\">\n";
echo " <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n";
echo " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n";
echo " <title>404 - 页面未找到</title>\n";
echo " <style>\n";
echo " body {\n";
echo " background-color: #0099CC;\n";
echo " color: #FFFFFF;\n";
echo " font-family: Microsoft Yahei, \"Helvetica Neue\", Helvetica, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif;\n";
echo " margin-left: 100px;\n";
echo " }\n";
echo " .face {\n";
echo " font-size: 100px;\n";
echo " }\n";
echo " p {\n";
echo " font-size: 24px;\n";
echo " padding: 8px;\n";
echo " line-height: 40px;\n";
echo " }\n";
echo " .tips {\n";
echo " font-size: 16px\n";
echo " }\n";
echo " /*针对小屏幕的优化*/\n";
echo " @media screen and (max-width: 600px) {\n";
echo " body {\n";
echo " margin: 0 10px;\n";
echo " }\n";
echo " p {\n";
echo " font-size: 18px;\n";
echo " line-height: 30px;\n";
echo " }\n";
echo " .tips {\n";
echo " display: inline-block;\n";
echo " padding-top: 10px;\n";
echo " font-size: 14px;\n";
echo " line-height: 20px;\n";
echo " }\n";
echo " }\n";
echo " </style>\n";
echo "<body>\n";
echo " <script>\n";
echo " var i = 5;\n";
echo " var intervalid;\n";
echo " intervalid = setInterval(\"cutdown()\", 1000);\n";
echo " function cutdown() {\n";
echo " if (i == 0) {\n";
echo " window.location.href = \"https://kejiyuzhe.chgskj.cn/\";\n";
echo " clearInterval(intervalid);\n";
echo " }\n";
echo " document.getElementById(\"mes\").innerHTML = i;\n";
echo " i--;\n";
echo " }\n";
echo " window.onload = cutdown;\n";
echo " </script>\n";
echo " <span class=\"face\">:(</span>\n";
echo " <p>您访问的页面没有找到。<br>\n";
echo " <span id=\"mes\"></span> 秒后转至网站首页;<br>\n";
echo " <p class=\"paddingbox\">或者在倒计时结束前点击以下链接继续浏览网页</p>\n";
echo " <p>🏠️<a style=\"cursor:pointer\" onclick=\"history.back()\">返回上一页面</a></p>\n";
echo " <span class=\"tips\">如果您想了解更多信息,则可以稍后在线搜索此错误: 算了你还是别搜了……</span>\n";
echo " </p>\n";
?>
© 版权声明
THE END
暂无评论内容