Home >php教程 >PHP源码 >php 分页类函数

php 分页类函数

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

php 分页类函数
function getPageBar($count = 0)
{
    $bad_link_color = "#C0C0C0";
   
    $page["url"]           = eregi_replace("&page=[^&]+","",basename($_SERVER[SCRIPT_NAME])."?".$_SERVER[QUERY_STRING]);
   
    $page["result_count"]  = (string) $count;
    $page["this_page"]     = (empty($_GET["page"]))?"1":$_GET["page"];
    $page["this_page"]     = ($page["result_count"] == 0)?"0":$page["this_page"];

    $page["page_size"]     = $GLOBALS["option"]["page_size"];
    $page["page_count"]    = (string) ceil($page["result_count"]/$page["page_size"]);
   
    $page["first_page"]     = ($page["this_page"] > 1)?"«":"";
    $page["rearward_page"]  = ($page["this_page"] »":"";
    $page["prev_page"]      = ($page["this_page"] > 1)?"":"";
    $page["next_page"]      = ($page["this_page"] ":"";
   
    $page['start_page'] = ((int)$page["this_page"]-5     $page['end_page'] = ((int)$page["this_page"]+5 > $page['page_count'])?(int)$page["page_count"]:(int)$page["this_page"]+5;

    for ($i = $page['start_page'];$i     {
        $selected = ($_GET["page"] == $i)?"selected":"";
        $page["page_select"]  .= "";
        $page["page_list"]  .= ($i == $page["this_page"])?" $i ":"[$i]";
    }
   
   
    return $page;
}

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