$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();
本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/1976085