路由设置的URL问题

时间:2015-08-25 05:25:49

标签: php codeigniter url-routing

$route['allgrant'] = "grant/allgrant";

以上内容适用于网址:http://localhost/grant/allgrant

但我收到网址http://localhost/grant/allgrant/6

的错误

我的路线设定如下:

$route['allgrant/(:num)'] = "grant/allgrant/$1";

我的控制器代码:

public function allGrant()
{
    $this->load->library('pagination');
    $config = array();
    $config["base_url"] = base_url('allGrant');
    $config['total_rows'] =   $this->db->count_all("grant_data");
    $config['per_page'] = 3;
    $config["uri_segment"] = 2;
    $this->pagination->initialize($config);
    $page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;
    $data["allGrant"] = $this->grant_model->allGrant($config["per_page"], $page);
        $data["links"] = $this->pagination->create_links();
    $data['mainContent'] = 'viewGrant';
    $this->load->view('include/template',$data);
}

当我加载所有授权页面时,它向我显示前三个结果,但是当我点击分页时,它会在找不到页面时出错

0 个答案:

没有答案