thinphp5.1 thinkcmf 数组查询

更新版本之后发现之前的写法不能用了,然后研究了半天

首先 引用use think\db\Where,然后就能随便使用了。。貌似这种容易sql注入,没有闭包查询的好

use think\db\Where;
$where          = new Where;
$where['status']=  ['<>', '2'];

 
        
        if (!empty($param['name']) ) { 
          $name=$param['name']; 
          $where['name'] =['like','%'.$name.'%'];
        }

        if (!empty($param['phone']) ) { 
            $phone=$param['phone']; 
            $where['phone'] =['like','%'.$phone.'%'];
        }

     $user_list=Db::name('usert')->where($where)->order('id', 'DESC')->paginate(10);
posted @ 2019-09-04 21:09  Twoknives_li  阅读(41)  评论(0)    收藏  举报