Friday 7 July 2017

Codeigniter Route

$route['what-will-typed-in-url']='what-action-to-perform';

//ex. url will like http://localhost/ci_testing/index.php/user/123

for this kind of url we don't have any 123 function in user controller but if this kind of url comes so we have to call user/myprofile function which means myprofile function of user controller. so for this we will create a route as:

$route['user/:num']='user/myprofile/$1';



here :num indicates any number after user and $1 will pass that number to myprofile function

we have to define this route in routes.php in config folder

banner
Previous Post
Next Post

0 comments: