.


Divya


Hello world example - CodeIgniter framework


In this example we will discuss about Hello world example CodeIgniter framework PHP.

We use two file for hello world example.

  1. Hello.php (CodeIgniter\application\controllers\Hello.php )
  2. hello_world.php (CodeIgniter\application\views\hello_world.php)

Hello.php

<?php  
defined('BASEPATH') OR exit('No direct script access allowed');  
  
class Hello extends CI_Controller {  
      
    public function index()  
    {  
        $this->load->view('hello_world');  
    }  
}  
?>  

hello_world.php

<!DOCTYPE html>
<html>
<head>
<title>Hello World !</title>
</head>
</body>

<h1>Hello World !</h1>

</body>
</html>

Now run the program on your browser with the below URL:

http://localhost/CodeIgniter/index.php/Hello