详细信息 您现在的位置是:首页 > ThinkPHP
thinkphp6多条件查询及常用写法
来源:
发布时间:2021-06-28
910 人已围观
摘要thinkphp6多条件查询及常用写法
thinkphp6多条件查询及常用写法
$map = [];
$map[] = ['ProductId','=',$v['ProductId']];
$map[] = ['OrderType','<>',""]; //不等于空
$map[] = ['OrderType','not null','']; //不等于null
$map[] = ['OrderType','null','']; //等于null
$map[] = ['OrderTime','between',[$Date0,$Date1]]; //在两数之间
$map[] = ['OrderTime','not between',[$Date0,$Date1]]; //不在两数之间
$map[] = ['TypeId','in',$ids]; //包含在逗号分割的字符里
$map[] = ['TypeId','not in',$ids]; //不含逗号分割的字符
$map[] = ['Name','like',"%$keys%"]; //包含关键字的字符
$list = Db::name('tables')->where([$map])->select();下一篇: 判断mysql字段值是否等于null
站点信息
- 电话:15226178738
- QQ:1697915848
- 邮箱:1697915848@qq.com