thinkphp 条件查询 模糊查询 区间查询 in 查询 与自定义查询
2021-06-21 12:04
标签:thinkphp thinkphp 条件查询 模糊查询 区间查询 in 查询 与自定义查询 标签:thinkphp 原文地址:http://anyuweb.blog.51cto.com/8675781/1947797 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())
上一篇:html5 storage事件
下一篇:mark Pay http://git.oschina.net/littleCrazy/dianshangpingtai-zhifu/blob/master/OrderPayController
文章标题:thinkphp 条件查询 模糊查询 区间查询 in 查询 与自定义查询
文章链接:http://soscw.com/essay/96893.html