thinkphp建立多个or条件查询


thinkphp5的查询条件使用

 $id= Db::name('operator')->where('name_operator','like','%'.$keywords.'%')->column('admin_id');
            $where = new \think\db\Query;
            $where->where(function ($query) use ($keywords,$id) {
                    $query->whereOr(
                        [
                            ['seller_id', 'in', $id],
                            ['name', 'like', '%' . $keywords . '%'],
                            ['phone', 'like', '%' . $keywords . '%']
                        ]
                    );
                });

 多个条件 模糊查询使用方法

而 thinkphp3.2 使用方法 组合查询使用技巧

$where['name']  = array('like', '%thinkphp%');
$where['title']  = array('like','%thinkphp%');
$where['_logic'] = 'or';
$map['_complex'] = $where;
->where($map);

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM