Controller
What is Controller
A controller is the mediator among models and perspectives to process HTTP demand and creates a page. All the solicitations got by the controller are given to models and perspectives to process the data. It is the focal point of each solicitation on your web application.
Think about after URI,
abc.com/index.php/front/
Right now, will attempt to discover Front.php record and Front class.
Controller Syntax
Take a gander at the above snaphsot, controller's record name is Main.php (first letter must be in capitalized) and class name is Main (first letter must be in capitalized).
What is Default Controller
The document determined in default controller will be stacked naturally when no record name is referenced in the URL. As a matter of course, it is Welcome.php which is the principal page to be seen subsequent to introducing CodeIgniter.
With URL
localhost/codeigniter/
Welcome.php will be stacked as there is no document name referenced in the URL.
In spite of the fact that according to your need, you can change default controller in the document application/config/routes.php.
$route['default_controller'] = ' ';
Here, indicate your record name which you need to be stacked as a matter of course.
Class Constructors
To utilize a constructor you have to make reference to the accompanying line of code,
Parent::__construct()
We have to physically call the parent constructor since nearby constructor will be superseding the one in the parent controller.