Codeigniter分页路由问题

Aad*_*adi 1 pagination routes codeigniter

我在routes.php中配置了一条路由,

$route['job-history/(:num)'] = "customer/customer/jobhistory/$1";
Run Code Online (Sandbox Code Playgroud)

和控制器中的分页配置如下,

$this->load->library('pagination');
$config['per_page'] = 25;
$config['total_rows'] = 100;
$config['base_url'] = $this->config->item('base_url').'job-history';
$config["uri_segment"] = 2;
$this->pagination->initialize($config);
$page = ($this->uri->segment(2)) ? $this->uri->segment(3) : 0;
Run Code Online (Sandbox Code Playgroud)

它在加载时显示404错误页面,

www.example.com/job-history

如果手动添加零,例如www.example.com/job-history/0,它将起作用.

如何将www.example.com/job-history作为首页加载.在我的配置中有什么不对.请帮忙

Ake*_*rts 12

您还需要一个单一job-history细分的路线.

$route['job-history/(:num)'] = 'customer/customer/jobhistory/$1';
$route['job-history'] = 'customer/customer/jobhistory';
Run Code Online (Sandbox Code Playgroud)