开发者

Dynamic URLs in CodeIgniter?

开发者 https://www.devze.com 2023-01-15 17:49 出处:网络
How to get URLs like /user/bob user/martin dyna开发者_如何学JAVAmically in CodeIgniter?You need to set up custom routing for the controller in application/config/routes.php, e.g.

How to get URLs like /user/bob user/martin dyna开发者_如何学JAVAmically in CodeIgniter?


You need to set up custom routing for the controller in application/config/routes.php, e.g.

$route['user/(:any)'] = "user/user_controller_method/$1";


you should use the

$route['user/(:any)'] = "user/user_controller_method/$1";

as James suggested, and then define the funcion on the user controller:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号