Php 使用codeigniter路由省略uri的一部分
我有这个urihttp://localhost/ur/index.php/reports/annual/gm/8312/44724286729 但年度部分的目的是向用户显示他/她正在查看的报告 因此映射的函数是带有参数的gmPhp 使用codeigniter路由省略uri的一部分,php,codeigniter,Php,Codeigniter,我有这个urihttp://localhost/ur/index.php/reports/annual/gm/8312/44724286729 但年度部分的目的是向用户显示他/她正在查看的报告 因此映射的函数是带有参数的gm public function gm($id,$telephone_number{ /** General Meeting */ } 在http://localhost/ur/index.php/reports/annual/gm/8312/44724286729 我的控
public function gm($id,$telephone_number{
/**
General Meeting
*/
}
在http://localhost/ur/index.php/reports/annual/gm/8312/44724286729
我的控制器文件称为reports。我如何使用routes来忽略annual,并仅使用gm和作为我的函数,以及uri的其他部分作为我的参数,即8312/44724286729
我已经在我的路线上试过了
您可以尝试使用美元符号语法
$route['reports/annual/(:any)/(:any)'] = "reports/gm/$1/$2";
在您的报表控制器中,gm函数将使用$1和$2作为参数
注意:参见CI手册中的章节
$route['reports/annual/(:any)/(:any)'] = "reports/gm/$1/$2";