ThinkPHP5中where查询条件使用数组时设置or或者and

admin 阅读:85 2024-03-01

ThinkPHP5中where查询条件使用数组时设置or或者and的写法:

$where['status'] = array(['=',1],['=',3],'or');

上面代码等同于:

where status = 1 or status = 3;

如果是:

$where['status'] = array(['>',1],['<',5],'and');

就等同于:

where status > 1 and status < 5
声明

1、部分文章来源于网络,仅作为参考。
2、如果网站中图片和文字侵犯了您的版权,请联系1943759704@qq.com处理!