tp5 数据表字段为逗号分隔的字符串,查询该字段中是否包含某个值
例:数据表cid字段为1,2,34,5,6,7,8,9,10,11
需求:需要查询cid为1的数据
解决:使用find_in_set(查找值,字段名)
Db::table('think_user')
->where('find_in_set(1,sids)')
->select();例:数据表cid字段为1,2,34,5,6,7,8,9,10,11
需求:需要查询cid为1的数据
解决:使用find_in_set(查找值,字段名)
Db::table('think_user')
->where('find_in_set(1,sids)')
->select();