thinkphp建立多个or条件查询

thinkphp5的查询条件使用

 $id= Db::name('operator')->where('name_operator','like','%'.$keywords.'%')->column('admin_id');
            $where = new 	hinkdbQuery;
            $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);

  

 

原文地址:https://www.cnblogs.com/kevin-yang123/p/13826980.html