当前位置:网站首页>Thinkphp5中一个字段对应多个模糊查询
Thinkphp5中一个字段对应多个模糊查询
2022-07-02 06:23:00 【夜空の雪風】
前言
最近在开发项目的时候遇到过一个查询条件:需要对一个字段进行多个模糊查询。
解决办法
public function getGroupUser($title)
{
//多个where条件查询
$condition = ['建设单位','监理单位','数字化单位'];
$where_supervisor['title'] = array('or');
foreach ($condition as $value) {
array_unshift($where_supervisor['title'], array('like', '%' . $value . '%'));
}
//拼接搜索条件
$query = self::where($where_supervisor);
return $query->order('key desc')->select();
}
边栏推荐
- Overload global and member new/delete
- [Zhang San learns C language] - deeply understand data storage
- Sqli labs customs clearance summary-page3
- Recursion (maze problem, Queen 8 problem)
- uniapp引入本地字体
- Build learning tensorflow
- PHP Session原理简析
- PXC high availability cluster summary
- Implement strstr() II
- SQLI-LABS通关(less15-less17)
猜你喜欢
Huawei mindspire open source internship machine test questions
The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
SQLI-LABS通关(less2-less5)
Brief analysis of PHP session principle
The use of regular expressions in JS
Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence
Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
The default Google browser cannot open the link (clicking the hyperlink does not respond)
Solve the problem of bindchange event jitter of swiper component of wechat applet
sqli-labs通关汇总-page4
随机推荐
js删除字符串的最后一位
默认google浏览器打不开链接(点击超链接没有反应)
php中时间戳转换为毫秒以及格式化时间
Improve user experience defensive programming
js中map和forEach的用法
SQL注入闭合判断
Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
Go common compilation fails
Kotlin - verify whether the time format is yyyy MM DD hh:mm:ss
Win电脑截图黑屏解决办法
SQLI-LABS通关(less1)
Latex compilation error I found no \bibstyle &\bibdata &\citation command
SQLI-LABS通关(less6-less14)
Sqli-labs customs clearance (less18-less20)
There is no way to drag the win10 desktop icon (you can select it, open it, delete it, create it, etc., but you can't drag it)
table 组件指定列合并行方法
js把一个数组分割成每三个一组
SQLI-LABS通關(less6-less14)
Review of reflection topics
Sentry construction and use