ThinkPHP6开发技巧:查询条件设置为不为空的二维数组写法

2023-01-1808:41:41后端程序开发Comments910 views字数 819阅读模式

设置不为空的查询写法,为空写成NULL即可文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30498.html

           $where[] = ['t.status_time''EXP', Db::raw('IS NOT NULL')];

其他的二维数组查询写法文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30498.html

            $where[] = ['t.pid''=', 0];
            $where[] = ['t.olddid''='$departmentId];
           
            $where[] = ['needreply''<>', 0];
            $where[] = ['title|content''like''%'.trim($param['keywords']).'%'];
            $where[] = ['status''in''20,40'];

时间相关的写法文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30498.html

                $st $param['starttime'].' 00:00:00';
                $et $param['endtime'].' 23:59:59';
                $stime strtotime($st);
                $etime strtotime($et);
                $where[] = ['add_time''between time', [$stime,$etime]];
                
                $st $param['starttime'].' 00:00:00';
                $stime strtotime($st);
                $where[] = ['add_time''>='$stime];
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30498.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/bc/30498.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定