怎么用php对mongodb进行模糊查询(查询条件中有中文)

WBOY
Release: 2016-06-13 13:20:12
Original
1140 people have browsed it

如何用php对mongodb进行模糊查询(查询条件中有中文)?
已知mongodb中有两条数据:
{"bc": "012345678","name": "维达纸巾花之韵","cls": "日用品","num": "100"}

{"bc": "12345678","name": "维达纸巾", "cls":"日用品", "num": "10" }

如何用php对其进行模糊查询,比如查询 name中含有“维达”的记录,则将两条记录全部返回。

哪位能帮忙写一个函数,传入参数是字符串(如“维达”),返回值是array数组。 谢谢了~~

------解决方案--------------------
http://www.lnmp100.com/505

其实就是正则。

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!