There are two ways to pay attention to paging: one is thinkphp3.2 and the other is that the previous page used a slightly different display effect.
Display effect:
Detail questions:
① Search page to add session judgment and paging
② modifying and adding pages requires a session judgment
③ permission settings for adding and deleting changes
Controller side:
1<?PHP2 namespace Home\controller;3 UseThink\controller;4 classUsercontrollerextendsController5 {6 Public functionUser () {7 8 if('? Username ')) {9 $m=m (' Fruit ');Ten //$arr = $m->select (); One //var_dump ($arr); A $total=$m-Count(); - //$this->assign (' data ', $arr); - $this->assign (' Sess ', session (' username '))); the - $page=New\home\publics\page ($total, 3); - //$page->limit;//limit n,n - $sql= "SELECT * from Fruit".$page-limit; + $lim=$m->query ($sql); - $pagelist=$page-fpage (); + $this->assign (' Data ',$lim); A $this->assign (' list ',$pagelist); at $this-display (); - } - Else{ - $this->redirect (' Login/login '); - } - in - to}
Front-end Display:
1<! DOCTYPE html>234<meta charset= "UTF-8" >5<title> Business </title>6<style type= "Text/css" >7A:Link {8Text-decoration:none;9 }Ten</style> One<script type= "Text/javascript" > A functionJump () { -window.location= "/tp/index.php/home/add/add"; - } the</script> -<style type= "Text/css" > - #se{ - float:Left ; +PositionAbsolute; -Margin-left:150px; + } A at</style> - -<body><div id= ' SE ' ><{$sess}> Hello! </div> -<div align= "center" display:inline style= "width:1380px;" > - -<form action= "__url__/search" method= "POST" > in<b> Enquiry </b> Sequence Number: <input type= "text" name= "IDs" > -Name: <input type= "text" name= "name" > toPrice: <input type= "text" name= "Prices" > +Origin: <input type= "text" name= "source" > -<input type= "Submit" value= "Search" ></input> the</form></div><br> *<table border= "1" width= "+" align= "center" > $<tr>Panax Notoginseng<th> Serial Number </th> -<th> name </th> the<th> Price </th> +<th> Origin </th> A<th> Operations </th> the</tr> +<volist name= ' data ' id= ' VO ' > -<tr> $<td><{$vo.ids}></td> $<td><{$vo.name}></td> -<td><{$vo.price}></td> -<td><{$vo.source}></td> the<td><a href= "/tp/index.php/home/user/del/ids/<{$vo.ids}> "> Delete </a> | <a href= "/tp/index.php/home/user/modify/ids/<{$vo.ids}> "> Modify </a></td> -</tr>Wuyi</volist> the -</table> Wu<div align= "center" ><{$list}></div> -<br> About<center> $<button onclick= "Jump ()" > Add Data </button> -</center> -</body> -View Code2016/05/17 thinkphp3.2.2 Paging use: ① in the home under the Publics folder or under the thinkphp of the library the vender put page.class.php test shell into the ② by the new instantiation method call $page =new \home\publics\page ($total, 3);