What are controllers in CodeIgniter

Controllers are very important in CodeIgniter project. It contains complete project's business logic. Controllers also works as a mediator between models (database classes) and views (HTML UIs). Controllers are bind with URLs, so whenever a user hits a URL based on URL and controllers mapping, appropriate controller function and classed gets called. Every controller in controller must be extended with CI_Controller controller class. Examples of views are mentioned below


class Students extends CI_Controller {

    public function index() {
        $this->load->model('Student_model');
        $data['student_detail'] = $this->Student_model->get_student_details($id);
        $this->load->view('student_details', $data);
    }
}