In the template file, submit the search content with the Get method, and set the G, M, C hidden fields.
<formAction= "{: U (' SCK/QBSCHJSC ')}"Method= "Get"> <Tableclass= "Search-tab"> <TR> <inputtype= "hidden"name= "G"value= "<?php echo module_name;?>"> <inputtype= "hidden"name= "M"value= "<?php echo controller_name;?>"> <inputtype= "hidden"name= "a"value= "<?php echo action_name;?>"> <thwidth= "+">Material Name:</th> <TD> <inputclass= "Common-text"name= "Mingcheng"size= " the"value=""type= "text"> </TD>
Handle in Controller
//Material Library Environment material retrieval Public functionQBSCHJSC () {$where= ' Fenxiang=1 '; //Query Parameters if(I (' request.leixing ')! = "){ if(I (' Request.mingcheng ')! = "){ $where. = ' and mingcheng like \ '% '. I (' Request.mingcheng '). '%\ ' ‘; } } ...$sck _model=m ("Kczz_sck"); $count=$sck _model->where ($where),Count(); $page=$this->page ($count, 10); $list=$sck _model->where ($where) ->order ("id desc") ->limit ($page->firstrow. ‘,‘ .$page-listRows)-Select (); $this->assign (' list ',$list); $this->assign (' page ',$page->show (' Admin ')); $this-display ();}
If the controller is the front desk, you need to import the page class yourself
<?phpnamespace Home\controller; UseThink\controller;classIndexcontrollerextendsController { Public functionsck () {$where= ' Fenxiang=1 '; //Query Parameters if(I (' request.leixing ')! = "){ if(I (' Request.mingcheng ')! = "){ $where. = ' and mingcheng like \ '% '. I (' Request.mingcheng '). '%\ ' ‘; } } ...$sck _model=m ("Kczz_sck"); Import (' ORG. Util.page ');//Import page-out class $count=$sck _model->where ($where),Count(); $Page=New\think\page ($count, 5); $show=$Page->show ();//pagination Display Output $list=$sck _model->where ($where) ->order ("id desc") ->limit ($Page->firstrow. ‘,‘ .$Page-listRows)-Select (); $this->assign (' list ',$list); $this->assign (' page ',$show); $this-display (); }}
Page flip code at the template
<class= "List-page"> {$page}</Div >
thinkphp with retrieval parameters paging