thinkphp 条件查询 模糊查询 区间查询 in 查询 与自定义查询

2021-06-21 12:04

阅读:413

标签:thinkphp

 eq => ‘=‘
$map[‘id‘]= array(‘eq‘,‘2‘);
neq => ‘‘
$map[‘id‘]=array(‘neq‘,2);
gt => ‘>‘
$map[‘id‘]=array(‘gt‘,3);
egt => ‘>=‘
$map[‘id‘]=array(‘egt‘,3);
lt => $map[‘id‘]=array(‘lt‘,3);
elt => $map[‘id‘]= array(‘elt‘,3);
模糊查询
$map[‘username‘]=array(‘like‘,‘%b%‘);
$map[‘username‘]=array(‘notlike‘,‘%b%‘);
$map[‘username‘]=array(‘notlike‘,array(‘%b%‘,‘%c%‘),‘AND‘);
区间查询
$map[‘id‘]=array(‘between‘,‘1,3‘);
$map[‘id‘]=array(‘between‘,array(‘1‘,‘3‘));
$map[‘id‘]=array(‘not between‘,array(‘1‘,‘3‘));
in 查询
$map[‘id‘]=array(‘in‘,array(‘1‘,‘2‘,‘3‘));
$map[‘id‘]=array(‘in‘,‘1,2,3‘);
$map[‘id‘]=array(‘not in‘,‘1,2,3‘);
自定义查询
$map[‘id‘]=array(‘exp‘,‘=1‘);
$map[‘id‘]=array(‘exp‘,‘>1‘);
$map[‘username‘]=array(‘exp‘,‘like "%%"‘);
$map[‘username‘]=array(‘exp‘,‘not like "%%"‘);
$map[‘id‘]=array(‘exp‘,‘>1‘);
$map[‘username‘]=array(‘exp‘,‘like "%bn%"‘);
$map[‘email‘]=array(‘exp‘,‘like "%bn%"‘);
$map[‘_logic‘]=‘OR‘;
var_dump($user->where($map)->select())


thinkphp 条件查询 模糊查询 区间查询 in 查询 与自定义查询

标签:thinkphp

原文地址:http://anyuweb.blog.51cto.com/8675781/1947797


评论


亲,登录后才可以留言!