1 //in the query condition, if there is a Chinese2 $keyword=UrlDecode(I ("Request.keyword"));3 if($keyword!=""){4 $Model=New\think\model ();5 6 //SQL query Criteria7 $condition[' name '] =Array(' like ', '% '.$keyword." %");8 $condition[' nickname '] =Array(' like ', '% '.$keyword." %");9 $condition[' telephone '] =Array(' like ', '% '.$keyword." %");Ten $condition[' _logic '] = ' OR '; One A $count=$Model->table (' UserInfo ')->where ($condition),Count(); - $Page=New\think\page ($count, 10); - the //query criteria bring in Parameters - $map[' keyword '] =$keyword; - foreach($map as $key=$val) { - $Page->parameter[$key]=UrlEncode($val); + } - $show=$Page->show ();//pagination Display Output + $list=$Model->table (' UserInfo ')->where ($condition)->limit ($Page->firstrow. ', '.$Page->listrows)Select (); A at $this->assign (' page ',$show);//Assignment Paging output - $this->assign (' list ',$list); - } - $this->display ();
thinkphp with query criteria data paging