<span style="font-size:18px;">    Emlog博客自带的错误提示就是纯文字,看起来不美观、不大气、不够好看,我们来修改一下,像这样的可以么?</span>
<p>

<span style="font-size:18px;"><a target="_blank" href="//www.zaihuiba.net/content/uploadfile/201710/4a471507849383.png" id="ematt:7"><img src="//www.zaihuiba.net/content/uploadfile/201710/thum-4a471507849383.png" title="点击查看原图" alt="1.png" border="0" width="420" height="349" /></a></span> 

</p>
<p>

<span style="font-size:18px;"> &nbsp; &nbsp;首先我们需要知道这个错误提示在哪个文件夹、哪个文件、哪个位置。</span> 

</p>
<p>

<span style="font-size:18px;">&nbsp; &nbsp; 登录博客虚拟主机,找到博客所在目录依次/include/lib/function.base.php</span> 

</p>
<p>

<span style="font-size:18px;">&nbsp; &nbsp; (建议下载此文件到电脑使用Notepad++软件编辑)找到</span><span style="font-size:18px;">第858 - 920行代码:</span> 

</p>
<p>

<span style="font-size:18px;"> </span> 

</p>

/**
 * 显示系统信息
 *
 * @param string $msg 信息
 * @param string $url 返回地址
 * @param boolean $isAutoGo 是否自动返回 true false
 */
function emMsg($msg, $url = 'javascript:history.back(-1);', $isAutoGo = false) {
if ($msg == '404') {
header("HTTP/1.1 404 Not Found");
$msg = '抱歉,你所请求的页面不存在!';
}
echo <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="//www.w3.org/1999/xhtml" lang="zh-CN">
<head>
EOT;
if ($isAutoGo) {
echo "<meta http-equiv="refresh" content="2;url=$url" />";
}
echo <<<EOT
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>提示信息</title>
<style type="text/css">
<!--
body {
background-color:#F7F7F7;
font-family: Arial;
font-size: 12px;
line-height:150%;
}
.main {
background-color:#FFFFFF;
font-size: 12px;
color: #666666;
width:650px;
margin:60px auto 0px;
border-radius: 10px;
padding:30px 10px;
list-style:none;
border:#DFDFDF 1px solid;
}
.main p {
line-height: 18px;
margin: 5px 20px;
}
-->
</style>
</head>
<body>
<div class="main">
<p>$msg</p>
EOT;
if ($url != 'none') {
echo '<p><a href="' . $url . '">&laquo;点击返回</a></p>';
}
echo <<<EOT
</div>
</body>
</html>
EOT;
exit;
}

<p>

<a target="_blank" href="//www.zaihuiba.net/content/uploadfile/201710/fb5c1507850762.png" id="ematt:9" style="font-family:&quot;"><img src="//www.zaihuiba.net/content/uploadfile/201710/thum-fb5c1507850762.png" title="点击查看原图" alt="2.png" border="0" width="420" height="198" /></a> 

</p>
<p>

<span style="font-size:18px;">替换成本文最后代码框里的代码,保存上传覆盖即可,随便打开一个错误页面看看是否成功。</span> 

</p>
<p>

<span style="font-size:18px;">替换前请先单独备份一份function.base.php文件,以免出错。</span> 

</p>
<p>

<span style="font-size:18px;">注:本文代码转自网络。</span>

</p>

Last modification:February 5th, 2020 at 01:26 pm
如果觉得我的文章对你有用,请随意赞赏