thinkphp3.2where多字段or查询

ThinkPHP3.* / 327人浏览 / 0人评论

thinkphp3.2框架中,where条件中多字段满足一个字段的条件就把记录筛选出来。

ThinkPHP3.2

ThinkPHP3.2where中的or查询

thinkphp3.2框架中,where条件中多字段满足一个字段的条件就把记录筛选出来。

        $where['status'] = ['eq', 1];
        $where['delete_time'] = ['eq', 0];
        $map['normal_integrals']  = ['gt', 0];
        $map['vip_integrals']  = ['gt', 0];
        $map['_logic'] = 'or';
        $where['_complex'] = $map;

        $list = M('coupon')
            ->field('*')
            ->where($where)
            ->order('id desc')
            ->page($page)
            ->limit($pageSize)
            ->select();

        $count = M('coupon')
            ->where($where)
            ->count();

转载注明:

扩展查找

0 条评论

还没有人发表评论

发表评论 取消回复

记住我的信息,方便下次评论
有人回复时邮件通知我