系统Db数组查询详细说明
tp6 去除了原有的数组查询 因为使用需要 本系统 有封装了数组查询操作 如下
1、等于
$where['title'] = 'xhadmin';
2、不等于
$where['amount'] = ['<>',2];
3、模糊查询
$where['amount'] = ['like','xhadmin'];
4、in查询
$where['amount'] = ['in',[2,5]];
5、not in 查询
$where['member_id'] = ['not in',[1,3]];
6、大于 不支持 gt
$where['amount'] = ['>',2];
7、小于 不支持lt
$where['amount'] = ['<',2];
8、between 区间
$where['amount'] = ['between','3,8'];
9、is null 为空
$where['amount'] = ['exp','is null'];
10、is not null 不为空
$where['amount'] = ['exp','is not null'];
11、or
$where['username|mobile'] = 'zhangsansan';
$where['amount'] = ['exp','=2 or amount =5'];
可以发现 exp 操作 可以自定义sql语句
然后在执行 formatWhere方法 如 formatWhere($where) 即可生成tp6可识别的sql语句