我如何以 GET 格式显示页码?在代码点火器中

how do i show the page numbers in GET format with ? in codeigniter

我遇到了一个困难,我认为必须有一个非常简单的答案。 我正在为我的项目使用 CodeIgniter,我正在使用 分页 来显示帖子的页码

代码

$this->load->library('pagination');
        if (count($_GET) > 0) $config['suffix'] = '?' . http_build_query($_GET, '', "&");
        $config['base_url'] = base_url('index.php/main/bloggers');
        $config['total_rows'] = $total_num;
        $config['per_page'] = $rec_per_page;
        $config['num_links'] = 10;
        $config['use_page_numbers'] = TRUE;
        $config['reuse_query_string'] = false;
        $config['full_tag_open'] = "<span class='page_num'>";
        $config['full_tag_close'] = '</span>';
        $this->pagination->initialize($config);

这段代码向我展示了 url 这样的

domain.com/index.php/main/blogger/**2**

其中 2 是好的页码

目前的url是这样的

domain.com/index.php/main/blogger/**2**

想要的url是

domain.com/index.php/main/blogger?**page=2**

问题:我想要的是我希望页码以 GET 类型的变量出现,这样我就可以使用 GET 并获取页面的值,就像我使用段一样 我不是当然有时也可能有其他值。

感谢任何帮助。

您需要在分页配置数组中设置以下选项:

// Set the pagination to use the get parameter
$config['page_query_string'] = TRUE;

// Set the name of the get paramater
$config['query_string_segment'] = 'page';