Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用codeigniter路由省略uri的一部分_Php_Codeigniter - Fatal编程技术网

Php 使用codeigniter路由省略uri的一部分

Php 使用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 我的控

我有这个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

我的控制器文件称为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";