//高亮显示函数
function bat_highlight($message,$words,$color = '#ff0000'){
if(!empty($words)){
$highlightarray = explode('+',$words);
$sppos = strrpos($message,chr(0).chr(0).chr(0));
if($sppos!==FALSE){
$specialextra = substr($message,$sppos+3);
$message = substr($message,0,$sppos);
}
$message = preg_replace(array("/(^|>)([^(.*)/siU"),array("\highlight('\\2', \$highlightarray, '\\1')","\\1"),$message);
if($sppos!==FALSE){
$message = $message.chr(0).chr(0).chr(0).$specialextra;
}
}
return $message;
}
function highlight($text, $words, $prepend) {
$text = str_replace('\"', '"', $text);
foreach($words AS $key => $replaceword) {
$text = str_replace($replaceword, ''.$replaceword.'', $text);
}
return "$prepend$text";
}
echo bat_highlight($rslist['name'],$key);