thinkphp5.1 查询构造器的数组多字段批量查询

浏览:15001 发布日期:2017/11/03 分类:ThinkPHP5专区 关键字: thinkphp5.1 数组条件
//原来的
$where=[
    'name'    =>    ['like','think%'],
    'id'    =>    ['>',0]
];
tp5.1 是这样的$where=[
    ['name','like','think%'],
        ['id','>',0],
];
或者
$where[]=['name','like','think%'];
$where[]=['id','>',0];
或者
$where['name']=['name','like','think%'];
$where['id']=['id','>',0];

如果需要条件合并
写成
$where1['status']=['status','=',1];
$where2['status']=['status','=',2];
$where=array_merge($where1,$where2);
最佳答案
评论( 相关
后面还有条评论,点击查看>>