以下是解决方法,已测试!
在e/class/functions.php中,查找代码:“ function ReplaceKey($newstext,$classid=0)” 或 “//替换关键字”(有时打开为utf-8时中文显示为乱码)
把这一大段大部分(即:“//替换关键字”部分)替换为以下代码:
———————————————————————————————–
//替换关键字
function ReplaceKey($newstext,$classid=0){
global $empire,$dbtbpre,$public_r,$class_r;
if(empty($newstext)||$class_r[$classid][‘keycid’]==-1)
{return $newstext;}
$where=”;
if(!empty($class_r[$classid][‘keycid’]))
{
$where=” where cid='”.$class_r[$classid][‘keycid’].”‘”;
}
$newstext=stripslashes($newstext);
preg_match_all(‘/<a[^>](.*)a>|<img[^>](.*)>/isU’,stripslashes($newstext),$rs);
if($rs[0]){
foreach($rs[0] as $k=>$v){
$newstext=str_replace($v,”[!–{$k}–]”,$newstext);
}
}
$sql=$empire->query(“select keyname,keyurl from {$dbtbpre}enewskey”.$where);
while($r=$empire->fetch($sql))
{
if(STR_IREPLACE)
{
$newstext=empty($public_r[repkeynum])?str_ireplace($r[keyname],'<a href=’.$r[keyurl].’ target=_blank class=infotextkey>’.$r[keyname].'</a>’,$newstext):preg_replace(‘/’.$r[keyname].’/i’,'<a href=’.$r[keyurl].’ target=_blank class=infotextkey>’.$r[keyname].'</a>’,$newstext,$public_r[repkeynum]);
}
else
{
$newstext=empty($public_r[repkeynum])?str_replace($r[keyname],'<a href=’.$r[keyurl].’ target=_blank class=infotextkey>’.$r[keyname].'</a>’,$newstext):preg_replace(‘/’.$r[keyname].’/i’,'<a href=’.$r[keyurl].’ target=_blank class=infotextkey>’.$r[keyname].'</a>’,$newstext,$public_r[repkeynum]);
}
}
if($rs[0]){
foreach($rs[0] as $k=>$v){
$newstext=str_replace(“[!–{$k}–]”,$v,$newstext);
}
}
return $newstext;
}