Today we are going to discuss about routing in codeigniter. Routing is the process of identifying controller and the method as per the http request. when a url is being given codeigniter routing mechanism will determine which page is to be responded to that request. For that codeigniter has various methods. By default they will provide routing as follows
so this will automatically pointed to controller called student. And the method called display will be invoked and the argument will passed to the function as rahul.
This is the default routing machanism of codeigniter. But programmer can change this scenario. A programmer can determine which controller is being invoked on which request. this can be done by editing the route file on application configuration.
that file contains a statement like this
$route['default_controller'] = "student";
which determines the default controller. now student is the default controller. So if you are not mention any controller then student will be your controller.
You can also apply regular expressions in the simplest way (:any) is the expression we can use as reqular expression
$route['(:any)'] = 'student/display/$1';
The statement above means when ever a request appears it will be mapped to student/display/(expression)
so if the request is
will be pointed to
Welcome to CodeigniterTutorial. Our aim is to teach codeigniter framework as simple as possible.
An Introduction to MVC and Codeignator framework
The figure given above is a simple representation of MVC. MVC is a coding standard
What is codeigniter
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you're tired of ponderously large and thoroughly undocumented frameworks, then CodeIgniter might be a good fit.