首页 文章

codeigniter 3.0使用get参数分页

提问于
浏览
0

我使用了codeigniter分页,我将GET参数添加到url . 问题是当我改为下一页时,我的所有GET参数都消失了

示例url参数:

http://localhost/test/index.php/search/product/?sort_by = price&order = ASC

当我点击下一页的第2页时,网址会变成这样:

http://localhost/test/index.php/search/product/5

我希望网址变成这样:

http://localhost/portofolio2/index.php/search/product/5?sort_by = price&order = ASC

================================================== =========================

更新<<

我将$ config ['suffix']添加到$ config数组,现在当我转到下一页时,GET参数没有消失 . 但是有一个新问题,当我再次导航回第一页我的GET参数消失时 .

这个我的$ config为分页看起来像

'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' => '&laquo',
        'prev_tag_open' => '<li class="prev">',
        'prev_tag_close' => '</li>',
        'next_link' => '&raquo',
        '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>',

谢谢

1 回答

相关问题