mysql-php matching string changes color after search

WBOY
Release: 2016-10-17 09:30:15
Original
1092 people have browsed it

How to make PHP search for mysql and change the color of matching strings?

For example, search 123

Assuming that it matches 123: 09148

1234097

It will change like this

Reply content:

How to make PHP search for mysql and change the color of matching strings?


For example, search 123

Assuming that it matches 123: 09148

1234097It will change like this

Regular replacement, html tag + css

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

The general idea is to find the keyword and add a style.

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!