thinkphp where查询数据库,同样一个列中,要用like还要用notlike,请问怎么实现

[0] => array(1) {
["c"] => string(43) "0,1,2,3,4,5"
}
[1] => array(1) {
["c"] => string(43) "0,3,4"
}
[2] => array(1) {
["c"] => string(43) "0,2,3,4"
}

比如这个数组,通过where查询时候,想要查询到topall中有2,但是不能有5的数组,我想到的是
$where['c']=array('like',"%2%");
$where['c']=array('notlike',"%5%");
但是查询出来的结果只是没有5的出来了,但是没有5确包含2的没有出来
请问如何写这个表达式

用了一个if做判断,if(stripos($bs['c'],"2")){
}
stripos用来查询字段中一个值的位置在哪里,我把他用成了是否包含2.
虽然解决了,还是很想请问大神,还有别的解决方法没

img


参考一下这个

写法应该是tp3.2?

img


看下这两个的用法,_logic 这个是 or 或者 and, _complex这个是 条件组合 (tp3.2没配置的话只能用一个,可以改下底层,加个_conplex1等等)

img


位置在

img