thinkphp3.2.3保持分页搜索条件

时间:2022-10-27 12:43:17
$level_name = I("level_name");

if(!empty($level_name)){
    $w['level_name']=array("like","%".trim(I('level_name'))."%");
}

$this->assign("level_name",I("level_name"));

$w['status'] = '1';

$level = M('store_employee_level'); // 实例化User对象  $count      = $level->where($w)->count();// 查询满足要求的总记录数  $Page       = new \Think\Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数(25)  if(!empty($level_name)){
    $w['level_name']=trim(I('level_name'));
}

foreach($w as $key=>$val) {
    $Page->parameter[$key]   =   $val;
}

$w['level_name']=array("like","%".trim(I('level_name'))."%");