php封装的page分页类完整实例代码
效果图
1.测试实例test.php
query('setnamesutf8'); $sql="SELECT*fromoperator_listwhere1=1"; $res_gg=$pdo->query("SELECTcount(*)asctnfromoperator_listwhere1=1;"); $result=$res_gg->fetch(); $total=$result["ctn"]; if(!empty($_GET['page'])&&$total!=0&&$curpage>ceil($total/$showrow)){ $curpage=ceil($total_rows/$showrow); } $sql.="LIMIT".($curpage-1)*$showrow.",$showrow;"; $res_zz=$pdo->query($sql); $result=$res_zz->fetchAll(); //print_r(json_encode($result));die; ?>