yii2/TP 逗号查询

yii2/TP 逗号查询

 $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();