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)