标签:like 记录 cond query amp 字段 pre mil build
在数据查询时候,多条件查询,使用场景
//单个值
$data_where[‘id‘] = 1
// in 条件 写法一
$ids = [1,2,3,4,5];
$data_where[] = [DB::raw("字段名 in ({$ids})"),‘1‘];
//in条件写法二
$data_where[] = [‘in‘=>[‘id‘=>$ids]];
$condition[] =[‘id‘,‘in‘,$ids]; // 这是错误的写法
// Illuminate\Database\Query\Builder关于operators定义中,并没有in
public $operators = [
‘=‘, ‘<‘, ‘>‘, ‘<=‘, ‘>=‘, ‘<>‘, ‘!=‘,
‘like‘, ‘like binary‘, ‘not like‘, ‘between‘, ‘ilike‘,
‘&‘, ‘|‘, ‘^‘, ‘<<‘, ‘>>‘,
‘rlike‘, ‘regexp‘, ‘not regexp‘,
‘~‘, ‘~*‘, ‘!~‘, ‘!~*‘, ‘similar to‘,
‘not similar to‘, ‘not ilike‘, ‘~~*‘, ‘!~~*‘,
];
标签:like 记录 cond query amp 字段 pre mil build
原文地址:https://www.cnblogs.com/richerdyoung/p/13836648.html