FIND IN SET函数

来自维基鲸

category_ids字段:2,4,8,13,25

原生SQL:

select * from table where FIND_IN_SET('13',category_ids)
 

ThinkPHP

$category_ids = 13;
$where[] = ['exp', Db::raw("FIND_IN_SET($category_ids,category_ids)")];