In the process of working on a project, you need to use the like keyword to combine query conditions. Below, the author will share the like query used in thinkphp.
Here are mainly examples to illustrate usage:
$userForm=M('user');
$where['name']=array('like','phpernote%'); $userForm->where($where)->select();
The like query here is: name like 'phpernote%'
$where['name']=array('like',array('%phpernote%','%.com'),'OR');
The like query here is: name like '%phpernote%' or name like '%.com'
$where['name']=array(array('like','%a%'),array('like','%b%'),array('like','%c%'),'phpernote','or');
The like query here is: (`name` LIKE '%a%') OR (`name` LIKE '%b%') OR (`name` LIKE '%c%') OR ( `name` = 'phpernote')
$where['_string']='(name like "%phpernote%") OR (title like "%phpernote")';
The like query here is: name like '%phpernote%' or title like '%phpernote'