当前位置:网站首页>TP5查询AND和OR条件嵌套
TP5查询AND和OR条件嵌套
2022-06-30 00:03:00 【cszzl123】
TP5查询AND和OR条件嵌套
采用闭包的方式使用tp5内置的查询方法
$where = [
'status'=> 1
];
$whereOr = [
'tel' => null,
'address' => null,
];
Db::name('user')
->where($where)
->whereOr(function($query) use ($whereOr){
$query->where($whereOr);
})
->select();
和如下sql语句效果相同
select id from user where status = 1 and (tel is null or address is null)
边栏推荐
- QT learning 04 Hello QT
- Binary search tree 230 The element with the smallest K in the binary search tree 1038 From binary search tree to larger sum tree
- Shell operator
- Construction of module 5 of actual combat Battalion
- golang7_ TCP programming
- Halcon practical: design idea of solder joint detection
- 手机开户后多久才能通过?另外,手机开户安全么?
- Vulnhub靶机-MoriartyCorp
- Inspiration collection · evaluation of creative writing software: flomo, obsidian memo, napkin, flowus
- 西门子低代码 9.14版本: 满足不同需求
猜你喜欢

代码分析平台 SonarQube 实战
500 error occurred after importing skins folder into solo blog skin

Zhongang Mining: Fluorite helps the construction and development of lithium battery in fluorine industry

QT learning 07 coordinate system in QT

After 8 years of polishing, "dream factory of game design" released an epic update!
![克隆無向圖[bfs訪問每條邊而不止節點]](/img/34/2a1b737b6095293f868ec6aec0ceeb.png)
克隆無向圖[bfs訪問每條邊而不止節點]

ThinkPad VMware installation virtual machine: this host supports Intel VT-x, but Intel VT-x is disabled (problem resolution)

Getting started with qpainter: drawing the chess interface

QT learning 05 introduction to QT creator project
![复制带随机指针的链表[空间换时间--hash记录]](/img/d9/d81e0e4f81174c61275e4affe0777a.png)
复制带随机指针的链表[空间换时间--hash记录]
随机推荐
Viewing splitchunks code segmentation from MPX resource construction optimization
Golang6 reflection
漫画安全HIDS、EDR、NDR、XDR
Solr basic operations 13
How about counting Berry Pie 4? What are the possible ways to play?
请指教同花顺软件究竟是什么?究竟网上开户是否安全么?
Simple understanding of B tree and b+ tree
Sword finger offer 14- ii Cutting rope II
QPainter的使用入门:绘制象棋界面
Sword finger offer 13 Range of motion of robot
Solr basic operation 10
History of deep learning
New CorelDRAW technical suite2022 latest detailed function introduction
Analysis of common vlog parameters
Solr基础操作7
Solr基础操作10
MySQL functions and constraints
label问题排查:打不开标注好的图像
[rust weekly library] Tokei - a utility for statistics of code lines and other information
Summarize Flink runtime architecture in simple terms