Data passing from Controller to View (Load View file in Controller) in CodeIgniter in PHP

 <?php

defined("BASEPATH") or exit("No direct script access allowed");

class News extends CI_Controller
{
    public function index()
    {
        echo "Welcome News";
        $data["title"] = "Latest Technology. This is the data of title.";
        $data["users"] = array("Ram", "Shyam", "Mohan", "Shubhash", "Manoj");
        $this->load->view("News/index.php", $data);
    }
    public function details($param1, $param2)
    {
        echo "Details News " . $param1 . " " . $param2;
    }
}





<h1>Welcome to Index File in News Folder</h1>
<?php
echo $title . "<br>";
echo "<pre>";
print_r($users);
?>




Comments