修改/thinkphp/paginator/driver/Bootstrap.php:70行
以下代码可直接用:/**
* 页码按钮
* @return string
*/
protected function getLinks()
{
if ($this->simple)
return '';
$block = [
'first' => null,
'slider' => null,
'last' => null
];
$side = 2;
$window = $side * 2;
if ($this->lastPage
$block['slider'] = $this->getUrlRange(1, $this->lastPage);
} elseif ($this->currentPage getUrlRange(1, $window + 1);
} elseif ($this->currentPage > ($this->lastPage - $window+1)) {
$block['slider'] = $this->getUrlRange($this->lastPage - ($window), $this->lastPage);
} else {
$block['slider']=$this->getUrlRange($this->currentPage-$side,$this->currentPage+$side);
}
$html = '';
if (is_array($block['first'])) {
$html .= $this->getUrlLinks($block['first']);
}
if (is_array($block['slider'])) {
$html .= $this->getUrlLinks($block['slider']);
}
if (is_array($block['last'])) {
$html .= $this->getUrlLinks($block['last']);
}
return $html;
}