|
问:在进行模糊搜索的时候,搜索指定字段的数据,例如表中多家公司,搜索这一家的, 处理模糊的搜索条件外, 还有一个前提条件, 就是 公司字段 id 等于 3 ,但是带上这个进行搜索,搜索的结果 就是拿到了所有的 id = 3 的数据,别的值也就不生效了;
$where['name'] = array('like','%'.$key.'%',);
$where['phone'] = array('like','%'.$key.'%');
$where['username'] = array('like','%'.$key.'%');
$where['leibie'] = array('like','%'.$key.'%');
$where['_logic'] = 'or
// 以上是模糊搜索条件 $map['_complex'] = $where;
// 下面是主要搜索条件
$map['_complex'] = $where;
$map['zhuangtai'] = array('EQ','接受委托')
$list=$info
->where($map)
->order("`" . $order . "` " . $sort)
->limit($numPerPage)
->page($pageCurrent.','.$numPerPage.'')
->select();
|
|