输入banner图图片脚本导航/分类

mysql-php搜索後符合的字串變色

要如何讓php搜索mysql後
讓符合的字串變色?

比如說搜尋 123

假設符合123的:091481234097

會變這樣

回复内容:

要如何讓php搜索mysql後
讓符合的字串變色?

比如說搜尋 123

假設符合123的:091481234097

會變這樣

正则替换,html标签+css

$keyword = yourobj->yourmethod();
$pattern = "/$keyword/i";
$replacement = "$keyword";
echo preg_replace($pattern, $replacement, $keyword);

大概思路就是,找到关键字,加个样式。