【发布时间】:2013-04-04 17:33:47
【问题描述】:
我在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 作为首页加载。我的困惑有什么问题。请帮忙
【问题讨论】:
-
@Cryode 是正确的。您可以尝试使用
$route['job-history(/:num)?'] = 'customer/customer/jobhistory$1';将两条路线组合成一条路线,我没有测试,但请尝试一下。
标签: codeigniter pagination routes