方法一:
$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();
转载请注明:苏demo的别样人生 » ThinkPHP中的like查询方法