TP6 数组查询 收集整理

$where=[];
        $where[]=['publish_status','=',3]; //查询publish_status为3
        $where[]=['company_id','=',0]; //查询company_id 为0
        $where[]=['is_display','=',1]; //查询is_display 为1
        $where[]=['notice_type','<>',0];//查询 不等于0
        $where[]=['notice_type','null',''];//查询 is null
        $where[]=['notice_type','<>','null'];//查询 不等于null
        $where[]=['notice_type','not null',''];//查询 is not null

          $announcement =Db::name('notice')->fetchSql(true)        
            ->where($where)
            ->field('notice_id,notice_type')
            ->order('release_time desc,notice_id desc')->select();
          echo $announcement;die;


版权声明:本文为tu1091848672原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。