PHP分页详细讲解(有实例)(3)


<?php
Class MemberPager extends Pager
{
   function showMemberList()
   {
       global $db;

       $data = $this->getPageData();
// 显示结果的代码
       // ......
   }
}
/// 调用
if ( isset($_GET['page']) )
{
   $page = (int)$_GET['page'];
}
else
{
   $page = 1;
}
$sql = "select * from members order by id";
$pager_option = array(
       "sql" => $sql,
       "PageSize" => 10,
       "CurrentPageID" => $page
);
if ( isset($_GET['numItems']) )
{
   $pager_option['numItems'] = (int)$_GET['numItems'];
}
$pager = @new MemberPager($pager_option);
$pager->showMemberList();
?>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/717919b7fa7fdfdc54bdf16917f20137.html