CodeIgniter Controllers




Controllers take care of moving the data between the model and the views, and directing traffic
based on user actions. For example, when a user submits a form, the controller collects the data and
shuffles it off to the model, which should ensure the data is valid. The controller then tells the View
(or JavaScript layer) whether it was successful.

How Controllers Work 

Before I explain how , let’s  look at the routes.php file . This file of this  Application->Config>routes.php.
Routes.php File
when we browse http://localhost/codeigniter/, CI wil lokk for welcome controller and by default call the index method.
If we add a entry in routes.php

then browse url http://localhost/codeigniter/home_page, CI will look for a method name home_pagein Welcome controller.
Source code  of Welcome controller