欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php简略数字分页显示代码

程序员文章站 2022-03-25 21:14:45
...
php简单数字分页显示代码
 $totalpages) {
   // set current page to last page
   $currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage ";
// while there are rows to be fetched...
/*
while ($list = mysql_fetch_assoc($result)) {
   // echo data
   echo $list['id'] . " : " . $list['number'] . "
"; } // end while */ /****** build the pagination links ******/ // range of num links to show $range = 3; // if not on page 1, don't show back links if ($currentpage > 1) { // show "; // get previous page num $prevpage = $currentpage - 1; // show "; } // end if // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x 0) && ($x $x] "; // if not current page... } else { // make it a link echo " $x "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " > "; // echo forward link for lastpage echo " >> "; } // end if /****** end build pagination links ******/ ?> 分页

摘自:http://www.phpfreaks.com/tutorial/basic-pagination

php简略数字分页显示代码

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频