$where1['id'] = 1; $where1['sex'] = 1; $where2['name'] = tom; $where2['sex'] = 2;
->where(function ($q) use($where1) { $q->where($where1); }) ->whereOr(function ($q) use($where2) { $q->where($where2); }) ->fetchSql(true) //打印出sql语句
->select();
$where1['id'] = 1; $where1['sex'] = 1; $where2['name'] = tom; $where2['sex'] = 2;
->where(function ($q) use($where1) { $q->where($where1); }) ->whereOr(function ($q) use($where2) { $q->where($where2); }) ->fetchSql(true) //打印出sql语句
->select();