首页 > 代码库 > 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用法