我对 CI 的路由有点陌生,而且我不太了解它(老实说一点也不)。我有以下需要更改的网址:
domain.com/mali_oglasi/index/1(一些数字)
它用于分页,我需要将其缩短为:
domain.com/mali_oglasi
我试过了:
$route['mali_oglasi/index/(:num)'] = 'mali_oglasi';
但它似乎不起作用(没有任何改变)。我做错了什么,需要改变什么?
来自控制器mali_oglasi的索引函数:
function index() {
$config['base_url'] = base_url().'mali_oglasi/index';
$config['total_rows'] = $this->db->count_all('ad');
$config['per_page'] = 10;
$this->pagination->initialize($config);
$data['pagination_links'] = $this->pagination->create_links();
$data['title'] = "Mali Oglasi | 010";
$data['oglasi'] = $this->mgl->mgl_get_all_home($config['per_page']);
$data['loc'] = $this->gi_loc;
$data['cat'] = $this->gi_cat;
$data['stylesheet'] = $this->css;
$data['main_content'] = 'mali_oglasi';
$this->load->view('template',$data);
}