在thinkphp6中,应该如何用in查询

当一个非常简单的查询,我们直接这样写就可以了。

$where = [];

$where['status'] = 1;

$lst = $this->where($where)->select();

如何涉及到比较复杂的查询,有in这样的嵌套查询,那么就必须这样写。

$where = [];

$where[] = ['memberid','=',$uid];

$where[] = ['itemid','in',$cartIds];

$lst = $this->where($where)->select();

备注:$cartIds 是一个字符串。

猜你喜欢

转载自blog.csdn.net/u010261924/article/details/115102906