天天看點

FIND_IN_SET在tp的用法

FIND_IN_SET(str,strlist)函數

str 要查詢的字元串

strlist 字段名 參數以”,”分隔 如 (1,2,6,8)

查詢字段(strlist)中包含(str)的結果,傳回結果為null或記錄

tp3一般用法 

         $where['_string'] =  'FIND_IN_SET('.$v2['id'].',bustaid)';

tp5用法

$list = $this->model_model->where("FIND_IN_SET($id,cid)")->field('id,pic,title,list_background,introduction')->order('sort,id')->select();

數組用法:

$where[] = ['exp',Db::raw("FIND_IN_SET({$cat},cat)")];