- A controller in MVC (Model View Controller) is responsible for the application flow of the program.
- Suppose you made a request in MVC pattern like structure, the controller is responsible for returning the response to the view.
- The controller can different types of values based on the application request.
- A controller is actually a coordinator between the model and view.
Controller
public function Profile() {
$data['email'] = $this->profileModel->getEmail();
$this->load->view('view_page',$data);
}
Model
public function getEmail() {
$email = 'texinterest@gmail.com';
return $email;
}