1

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

$route['job-history/(:num)'] = "customer/customer/jobhistory/$1";

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

$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;

加载时显示404错误页面,

www.example.com/job-history

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

如何加载 www.example.com/job-history 作为第一页。我的困惑有什么问题。请提供任何帮助

4

2 回答 2

12

您还需要单个job-history航段的路线。

$route['job-history/(:num)'] = 'customer/customer/jobhistory/$1';
$route['job-history'] = 'customer/customer/jobhistory';
于 2013-04-12T09:32:29.937 回答
2

因为,在 route.php 中,您只提到了后面有数字段的作业历史页面,并且您的页面作业历史没有这样的规则,它被重定向到 404。

添加

$route['job-history'] = 'customer/customer/jobhistory';

$route['job-history/(:num)'] = 'customer/customer/jobhistory/$1';
于 2013-04-12T09:56:07.290 回答