TAG
6 条评论
-
@888888P 四楼问题解决方法:
搜索插件染色search.func.php代码更新一下。感谢原作者@百晓生
function search_keyword_highlight($s, $keyword_arr) { foreach($keyword_arr as $key => $keyword) { if($key >= 1){ $chunks = preg_split('/(<span.*?\/span>)/ms', $s, - 1, PREG_SPLIT_DELIM_CAPTURE); foreach ($chunks as $c) { if (strpos($c, '<span') !== 0){ $tmp = $c; $c = str_ireplace($keyword, '<span class="text-danger">'.$keyword.'</span>', $c); $s = str_ireplace($tmp, $c, $s); } } }else{ $s = str_ireplace($keyword, '<span class="text-danger">'.$keyword.'</span>', $s); } } return $s; }