Home >php教程 >PHP源码 >php+ajax分页代码

php+ajax分页代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:30:451093browse
<script>ec(2);</script>










 page.php代码.

class class_page
{
    private $record_count, $perpage;
    private $page_count, $page_current;
   
    function __construct($perpage, $record_count, $page_current)
    {
        $this->perpage = $perpage;
        $this->record_count = $record_count;
        $this->page_count = ($record_count == 0) ? 1 : ceil($record_count / $perpage);
        $this->page_current = ($page_current > $this->page_count) ? 1 : $page_current;
    }

    function __get($name)
    {
        switch($name)
        {
        case 'page_count':
            return $this->page_count;
        case 'page_current':
            return $this->page_current;
        case 'record_start':
            return ($this->page_current - 1) * $this->perpage;
        }
    }
}

header('Content-Type: text/xml; charset=gbk');
$page = new class_page(20, 150, is_numeric($_GET['page']) ? $_GET['page'] : 1);
echo '';
echo '';
echo '' . $page->page_count . '';
echo '' . $page->page_current . '';
echo '' . pow($page->page_current, 2) . '';
echo '
';
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP+DBM的同学录程序(2)Next article:创建文件夹