Home > php教程 > php手册 > PHP搜索关键词描红函数 十分不错的,备份!

PHP搜索关键词描红函数 十分不错的,备份!

WBOY
Release: 2016-06-06 19:49:41
Original
1450 people have browsed it

2012-12-23 点击看最新版本:http://blog.csdn.net/default7/article/details/8373293 ——————————————————————————————————————————————— PHP搜索关键词描红函数: function SearchReplaceKw($string,$sokw=

2012-12-23 点击看最新版本:http://blog.csdn.net/default7/article/details/8373293

———————————————————————————————————————————————


PHP搜索关键词描红函数:


function SearchReplaceKw($string,$sokw=''){
  if(empty($sokw) || empty($string)) return $string;
  $badString = array(
  '~',  '!',  '@',  '#',  '$',  '%',  '^',  '&',  '*',  '(',  ')',  '-',  '+',  '[',  ']',
  ':',  ';',  '\'', '"',  '|',  '\\', ',',  '.',  '?',  '/',  '',
  );
  $sokw = str_replace($badString,' ',$sokw);
  $sokw = preg_replace('/\s+/','|',$sokw);
  return preg_replace("/($sokw)/",'\\1',$string);
  }


因为不能发布,所有我直接粘贴了。

截图:

PHP搜索关键词描红函数 十分不错的,备份!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template