分页后缀在以前的链接上不起作用

max*_*max 5 codeigniter

您好在我的分页代码中

$config['base_url']    = base_url().'cp/orders/';
$config['suffix'] = '?'.http_build_query($_GET, '', "&");
$config['uri_segment'] = 3;
$config['total_rows']  = $count_all;
$config['per_page']    = 20 ;
$this->pagination->initialize($config);
echo $this->pagination->create_links();
Run Code Online (Sandbox Code Playgroud)

所以在第一页中,当我单击第2页时,它可以正常工作

http://mysite.com/cp/orders/20?sort=id&adc=desc
Run Code Online (Sandbox Code Playgroud)

但是在第二页中,如果我单击第一页或上一页(<),它将转到

http://mysite.com/cp/orders/20
Run Code Online (Sandbox Code Playgroud)

这个

$config['suffix'] = '?'.http_build_query($_GET, '', "&");
Run Code Online (Sandbox Code Playgroud)

在以前的链接中不起作用!

Ake*_*rts 4

我发现并修复了一个与首页链接与其余页面链接不一致相关的错误。我建议使用 Github 存储库中的当前版本扩展 Pagination 库,直到 CodeIgniter 3.0 发布,届时它将是内置的,您可以删除扩展库。

新版本还有一个名为 的配置选项reuse_query_string,设置为 时TRUE将保留任何现有的查询字符串。因此,如果您到达该页面时它们已经存在,则无需担心将它们指定为后缀。

$config['reuse_query_string'] = TRUE;
Run Code Online (Sandbox Code Playgroud)

当前库文件:https://github.com/EllisLab/CodeIgniter/blob/develop/system/libraries/Pagination.php 相关拉取请求及信息:https://github.com/EllisLab/CodeIgniter/pull/2199