在CodeIgniter中路由所有URL请求?

时间:2011-01-28 12:46:55

标签: php codeigniter

有没有办法捕获所有网址请求并路由它们?有点像:

$route['everything'] = "controller";

3 个答案:

答案 0 :(得分:5)

$route['(:any)'] = "controller";

答案 1 :(得分:2)

$route['(:any)'] = "your_controller/your_method/$1";

这应该有效。这样,(:any)中的内容将作为参数传递给您的方法。

答案 2 :(得分:1)

试试这个 -

$route[':any'] = 'path of the default controller';

你可以获得它的文档here