$newWhere = ' FIND_IN_SET("468", b.fangCharachteristic)';
Yii2多个关键字查询
$kw=explode(',',$data['keyword']);
foreach($kw as $k=>$v){
if($k==0){
$wheres[] = 'or';
$wheres[] = 'FIND_IN_SET(:id'.$k.',keyword)';
}else{
$wheres[] = 'FIND_IN_SET(:id'.$k.',keyword)';
}
$wheress[':id'.$k] = $v;
}
$query->where(
$wheres
, $wheress);
$query->asArray();
$datalike=$query->one();
echo $query->createCommand()->getRawSql();
转载于:https://blog.51cto.com/liang3391/1976085