thinkphp5 WhereIn查询写法

php / 181人浏览 / 0人评论

sql语句中的where....in 用起来比较方便,但是在TP的model下面whereIn要怎么用呢?今天在查标签列表用到了TP5 model下的whereIn,做个记录,顺便和大家分享......

方法一:

$data = array();
$data['id'] = array('in','4');
$tag = $tag->where($data)->select();

方法二:

$tag = $tag->where(array('id'=>array('in','4')))->select();
$tag = $tag->where(array('id'=>array('in',array('4'))))->select();

评论列表

还没有人发表评论

发表评论 取消回复