Codeigniter Pass Data To View

Codeigniter pass data to view : Codeigniter provides functionality to pass data from the controller on views in form of array or object.

Codeigniter pass data to view Example

defined('BASEPATH') OR exit('No direct script access allowed');

class Blogdataexample extends CI_Controller {

public function index(){

$data = array(
 'title' => 'Blog Data Example',
 'heading' => 'Blog Data Example Heading......',
 'content' => 'Demo content starts here.......'


Try it »

You can pass data as an object :

Example :

$data =  new MyClassName();


Add Comment

📖 Read More