How can a controller in CodeIgniter pass data to a view?

  • Using $this->data('key', 'value')
  • Using $this->load->set('key', 'value')
  • Using $this->load->view('view_name', $data)
  • Using $this->view->set('key', 'value')
In CodeIgniter, data can be passed to a view by using the $this->load->view('view_name', $data) method, where 'view_name' is the name of the view file, and $data is an associative array containing the data to be passed.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *