Home  >  Article  >  Backend Development  >  怎么用php对mongodb进行模糊查询(查询条件中有中文)

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

WBOY
WBOYOriginal
2016-06-13 13:20:121141browse

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

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

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

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

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

其实就是正则。

Statement:
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