currentPage() <= 1) { return $this->getDisabledTextWrapper($str); } $url = $this->url(1); return $this->getPageLinkWrapper($url, $str); } // 上一页 protected function getPreviousButton($text = "«") { if ($this->currentPage() <= 1) { return $this->getDisabledTextWrapper($text, 'prev'); } $url = $this->url( $this->currentPage() - 1 ); return $this->getPageLinkWrapper($url, $text, 'prev'); } // 页码 protected function getLinks() { if ($this->total > $this->listRows) { if ($this->lastPage < $this->btnNumber) { return $this->getUrlLinks($this->getUrlRange(1, $this->lastPage), false); } else { $min = 1; if ($this->currentPage > $this->btnNumber / 2) $min = $this->currentPage - floor($this->btnNumber / 2); if ($this->lastPage - $this->currentPage < $this->btnNumber / 2) $min = $this->lastPage - $this->btnNumber + 1; $max = $min + $this->btnNumber - 1; $ellipsis = false; if ($this->lastPage > $max) { $ellipsis = true; $max = $max - 1; } return $this->getUrlLinks($this->getUrlRange($min, $max), $ellipsis); } } } // 下一页 protected function getNextButton($text = '»') { if (!$this->hasMore) { return $this->getDisabledTextWrapper($text, 'next'); } $url = $this->url($this->currentPage() + 1); return $this->getPageLinkWrapper($url, $text, 'next'); } // 末页 protected function getLastButton($text = '') { if (!$this->hasMore) { return $this->getDisabledTextWrapper($text); } $url = $this->url($this->lastPage()); return $this->getPageLinkWrapper($url, $text); } // 渲染分页 $btnNumber [0 只显示上下页 | >= 3] public function render($btnNumber = 10, $type = '') { if($btnNumber == 0 || $btnNumber >= 3) { $this->btnNumber = $btnNumber; } //数据是否足够分页 if ($this->hasPages()) { if(strtoupper($type) == 'A') { return sprintf( '