tp5 where多条件

tp5 下where条件需要同时满足多条时:

(reward_time大于等于$a [ 且/或 ] 小于$b)

//默认 and 
$andWhere['reward_time'] = array(['egt',$a],['lt',$b]);
//或 or
$orWhere['reward_time'] = array(['egt',$a],['lt',$b],'or');
#------------查询实例
db('user')->where($orWhere)->select();

#补充------------
//between
$betweenWhere['reward_time'] = array('between','1,8');
$notBetweenWhere['reward_time'] = array('not between','1,8');

//in
$inWhere['reward_time'] = array('in','1,2,6,8');
$notInWhere['reward_time'] = array('not in','1,2,6,8');

//like
$likeWhere['u.username|en.exName']=array('like','%'.$keyword.'%');

 吾生也有涯,而知也无涯~欢迎优化补充、指正!

网友提供的一张图表,特别感谢“ 我是高手高手高高手

tp5 where多条件_第1张图片

如有疑问,请与我联系

你可能感兴趣的:(PHP,tp5)