码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-07-15 12:43:02      阅读:160      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!