THINKPHP:要让 where条件和 whereOr条件组合,实现 AND(条件1 AND 条件2 OR 条件3) 这样的逻辑
->where($condition) // AND 条件->where(function($query) use ($or_condition) {// 使用 whereOr 传递数组$query->whereOr($or_condition);})上面的代码中:$condition和$or_condition都是数组形式的条件:[['user_id','=',1],[
->where($condition) // AND 条件
->where(function($query) use ($or_condition) {
// 使用 whereOr 传递数组
$query->whereOr($or_condition);
})
上面的代码中:$condition和$or_condition都是数组形式的条件:[['user_id','=',1],['nickname','=','小明']]
实现让$condition和$or_condition以AND进行连接,$condition内以AND进行连接,$or_condition内以OR进行连接。



