我使用了codeigniter分页,我将GET参数添加到url。问题是当我改为下一页时,我的所有GET参数都消失了
示例url +参数:
http://localhost/test/index.php/search/product/?sort_by=price&order=ASC
当我点击下一页的第2页时,网址会变成这样:
我希望网址变成这样:
http://localhost/portofolio2/index.php/search/product/5?sort_by=price&order=ASC
=============================================== ============================
更新<<
我将$ config ['suffix']添加到$ config数组,现在当我转到下一页时,GET参数没有消失。但是有一个新问题,当我再次导航回第一页我的GET参数消失时。
这个我的分配配置看起来像
'base_url' => base_url() . 'index.php/search/product/',
'suffix' => '?sort_by=' . $sort_by . '&order=' . $order,
'use_global_url_suffix' => TRUE,
'reuse_query_string' => FALSE,
'total_rows' => $this->products_model->total_row(),
'per_page' => 5,
'num_links' => 20,
'full_tag_open' => '<ul class="pagination">',
'full_tag_close' => '</ul>',
'first_link' => FALSE,
'last_link' => FALSE,
'first_tag_open' => '<li>',
'first_tag_close' => '</li>',
'prev_link' => '«',
'prev_tag_open' => '<li class="prev">',
'prev_tag_close' => '</li>',
'next_link' => '»',
'next_tag_open' => '<li>',
'next_tag_close' => '</li>',
'last_tag_open' => '<li>',
'last_tag_close' => '</li>',
'cur_tag_open' => '<li class="active"><a href="#">',
'cur_tag_close' => '</a></li>',
'num_tag_open' => '<li>',
'num_tag_close' => '</li>',
由于
答案 0 :(得分:3)
http://www.codeigniter.com/userguide3/libraries/pagination.html#customizing-the-pagination
AND $config[‘reuse_query_string’] = FALSE;
// UPDATE(第一页出现问题):
$ config之后:
$config['first_url'] = $config['base_url'] . $config['suffix'];