thinkPHP or PHP project implements fuzzy query

不言
Release: 2023-03-23 16:22:02
Original
2334 people have browsed it

The content of this article is about how to implement fuzzy query in thinkPHP or PHP projects. Friends in need can refer to it

How to implement fuzzy query in thinkPHP or PHP projects?

I searched online today and can use like in mysql to achieve it

How to use it?

Look at the code:

Incorrect usage:

where('title','like',$search.'%') -> select();

Correct usage:

where('title','like','%'.$search.'%') -> select();

Be sure to pay attention Use two % to wrap the keyword variable to be queried. Otherwise it will be invalid! ! ! ! ! ! ! !

Don’t step on the pits you have stepped on again! ! ! !


The above is the detailed content of thinkPHP or PHP project implements fuzzy query. For more information, please follow other related articles on the PHP Chinese website!

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 Tutorials
More>
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!