首页 > 代码库 > ThinkPHP中的like查询方法

ThinkPHP中的like查询方法

 

方法一:
$carrymodel = D(“Carry”);
$condition["FromAddress"] = array(“like”, “%”.$rname);
$condition["ToAddress"] = array(“like”, “%”.$rname);
$carryrecord = $carrymodel->where($condition)->findAll();

方法二:
$model = new Model();
$carryrecord = $model->table(‘dh_info_carry a’)
->field(‘a.*’)
->where(‘a.ToAddress like “%’.$rname.’” or a.FromAddress like “%’.$rname.’”‘)
->findAll();

ThinkPHP中的like查询方法