Php 使用方法和编辑的codeigniter路由

Php 使用方法和编辑的codeigniter路由,php,codeigniter,routes,Php,Codeigniter,Routes,我遇到了密码点火器路线的麻烦 我需要这样做: method/:any = method/index_function method/edit/:any = method/edit_function 我在路由配置文件中写了以下内容: $route['method/:any'] = 'method/index'; $route['method/edit/:any'] = 'method/edit'; 但我不想要工作 有什么建议吗 决心 我更改管线文件中该行的顺序: $route['method

我遇到了密码点火器路线的麻烦

我需要这样做:

method/:any = method/index_function
method/edit/:any = method/edit_function
我在路由配置文件中写了以下内容:

$route['method/:any'] = 'method/index';
$route['method/edit/:any'] = 'method/edit';
但我不想要工作

有什么建议吗

决心

我更改管线文件中该行的顺序:

 $route['method/edit/:any'] = 'method/edit';
 $route['method/:any'] = 'method/index';

感谢Basheer Ahmed

如果我没有弄错的话,您的路由密钥不能与现有控制器同名,因为CodeIgniter将首先检查控制器,如果找到一个,它将尝试调用该控制器中的方法。请尝试:

$route['m/:any'] = 'method/index';
$route['m/edit/:any'] = 'method/edit';

路由将按定义的顺序运行。较高的路线将始终优先于较低的路线


基本上你忘了用括号了。Codeigniter路由确实非常有效。以下是我如何在项目中实现相同目标的示例:

$route['listnote/stepone/(:any)']='listnote/listnote/loanInformation';

method/:any=method/index\u function method/edit/:any=method/edit\u function尝试我的更新答案我在配置文件中写道:$route['dog/:any']='dog/index'$路由['dog/edit/any']='dog/edit';但是不要尝试在任何情况下使用圆形偏执,然后尝试当您尝试dog/1如果我的用户dog/1工作时会发生什么情况,但是如果我尝试dog/edit/1,我有一个404错误谢谢!这很有效!问题是线路的顺序!我在配置文件中写到:$route['dog/:any']='dog/index'$路由['dog/edit/any']='dog/edit';你能用什么来定义它不起作用吗?你收到错误信息了吗?如果没有,是否将错误报告设置为E_ALL并启用了“显示错误”?我不是很确定,但是试着把:任何在括号里我都有一个404错误!我尝试添加括号,但什么也没有!这些不是括号,而是括号
$route['listnote/stepone/(:any)']='listnote/listnote/loanInformation';