Php CodeIgniter中的动态URL?

Php CodeIgniter中的动态URL?,php,codeigniter,Php,Codeigniter,如何在CodeIgniter中动态获取/user/bob user/martin之类的URL?您需要在application/config/routes.php中为控制器设置自定义路由,例如 $route['user/(:any)'] = "user/user_controller_method/$1"; 你应该使用 $route['user/(:any)'] = "user/user_controller_method/$1"; 按照James的建议,然后在用户控制器上定义函数: func

如何在CodeIgniter中动态获取/user/bob user/martin之类的URL?

您需要在application/config/routes.php中为控制器设置自定义路由,例如

$route['user/(:any)'] = "user/user_controller_method/$1";
你应该使用

$route['user/(:any)'] = "user/user_controller_method/$1";
按照James的建议,然后在用户控制器上定义函数:

function user_controller_method($username) {
   // ... $username should be the url param
}