public static function create($totalPage, $pageSize = 10, $page = 1, $gets = [])
    {
        $p = new PageUtil();
        if ($pageSize < 1) {
            $pageSize = 1;
        }

        $total = ceil($totalPage / $pageSize);

        if ($page < 1) {
            $page = 1;
        } else if ($page > $total) {
            $page = $total;
        }

        $p->page = $page;
        $p->gets = $gets;
        $p->total = $total;
        $p->pageSize = $pageSize;
        return $p;
    }
public static function create($totalPage, $pageSize = 10, $page = 1, $gets = [])
    {
        $p = new PageUtil();
        if ($pageSize < 1) {
            $pageSize = 1;
        }

        $total = ceil($totalPage / $pageSize);

        if ($page < 1) {
            $page = 1;
        } else if ($page > $total) {
            $page = $total;
        }

        $p->page = $page;
        $p->gets = $gets;
        $p->total = $total;
        $p->pageSize = $pageSize;
        return $p;
    }
public static function create ( $ totalPage , $ pageSize = 10 , $ page = 1 , $ gets = [ ] ) { $ p = new PageUtil ( ) ; if ( $ pageSize < 1 ) { $ pageSize = 1 ; } $ total = ceil ( $ totalPage / $ pageSize ) ; if ( $ page < 1 ) { $ page = 1 ; } else if ( $ page > $ total ) { $ page = $ total ; } $ p -> page = $ page ; $ p -> gets = $ gets ; $ p -> total = $ total ; $ p -> pageSize = $ pageSize ; return $ p ; }
Page constructor.
@param $totalPage int 总条数
@param int $pageSize 每页显示条数
@param int $page 当前页码
@param array $gets url携带get参数数组
@return self
Page constructor .