<?php
   $pageSize=10;//每页显示多少条记录
   $pageCount=1;//共有多少页",需要查数据库
   $pageNow=1; //当前页
   $start_number=($pageNow-1)*$pageSize;  //关键点
   $sql2="select * from xxx where xxx between 'xxx' and 'xxx' limit {$start_number} , {$pageSize}";
   if ($pageNow>1){
      $prepage=$pageNow-1;
      echo"<a href='countlist.php?pageNow=$prepage>上一页</a>&nbsp&nbsp"; 
   }
   if($pageNow<$pageCount){
        $nextpage=$pageNow+1;
      echo "<a href='countlist.php?pageNow=$nextpage>下一页</a>&nbsp&nbsp"; 
   }
   $start=floor(($pageNow-1)/10)*10+1;  //关键点 打印超链接的个数算法
   $index=$start;
   if($start>10){
        echo "<a href='countlist.php?pageNow=".($start-1)."'><<</a>&nbsp&nbsp";
   }
   for(;$start<$index+10;$start++){
        echo "<a href='countlist.php?pageNow=$start'>[$start]</a>&nbsp&nbsp";  
   }//关键点 打印超链接的个数算法
   echo "<a href='countlist.php?pageNow=$start>>></a>&nbsp&nbsp";
   echo "当前是第&nbsp$pageNow&nbsp页/共有&nbsp$pageCount&nbsp页&nbsp&nbsp";
   echo "<form method='get' id = 'jump' action='????' >跳转到第:<input type='text' id='jump_text' name='pageNow' />页<input type='submit' value='GO' /></form>";
?>