gpt4 book ai didi

php - CodeIgniter 分页类,事件链接不起作用

转载 作者:可可西里 更新时间:2023-10-31 22:45:46 26 4
gpt4 key购买 nike

我是第一次使用 codeigniter 的分页类。其他一切都工作正常,但无论我要去哪个页面,事件链接始终是 [1] 并且它不会改变。此外,下一个按钮始终链接到第一页。想不通为什么!请帮忙!

Controller

public function unverified_images()
{
$data['title'] = 'Choose from the below Images to verify them >>';
$data['total_rows'] = $this->admin_model->all_unverified_images();

$config['base_url'] = base_url().'index.php/admin/admin/unverified_images';
$config['total_rows'] = $data['total_rows']->num_rows();
$config['per_page'] = 1;
$config['num_links'] = 8;
$config['full_tag_open'] = '<div class="pagination">';
$config['full_tag_close'] = '</div>';

$this->pagination->initialize($config);

$data['query'] = $this->db->where('image_status', 0)
->get('tbl_img', $config['per_page'], $this->uri->segment(4));
$data['links']=$this->pagination->create_links();
$this->load->view('admin/image_verify', $data);
}

public function verify_image()
{
$data['title'] = 'Choose from the below Images to verify them >>';
$data['msg'] = $this->admin_model->verify_image();
$data['query'] = $this->admin_model->all_unverified_images();
redirect('admin/admin/unverified_images');
}

型号

function all_unverified_images()
{
$this->db->where('image_status', 0);
$query = $this->db->get('tbl_img');
return $query;
}

查看

   <?php echo $links; ?>

最佳答案

听起来 CI 无法确定您应该在哪个页面上。尝试为 $config 数组添加 uri_segmentcur_page

uri_segment 应该告诉 CI url 的哪一部分包含当前页码,从您的示例代码来看它似乎是 4 (来自查询),而 CI 是默认的是 3.

关于php - CodeIgniter 分页类,事件链接不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12121606/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com