CodeIgniter First Example
A controller is set up to deal with static pages. A controller is a class that streamlines the work in CodeIgniter.
In a CodeIgniter system URL an essential example is followed.
In the accompanying URL,
http://abc.com/book/novel/
Here, 'book' is the controller class or you can say this is the controller name.
'novel' is the strategy that is called. It stretches out to CI_Controller to acquire the controller properties.
An Example to print Hello World
Create file in Controllers
In Controller make a document named "Hello.php". This document will be spared in the Controller envelope of your CodeIgniter. Compose the accompanying coding.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Hello extends CI_Controller {
public function index()
{
$this->load->view('hello_world');
}
}
?>
Here, your controller class is Hello, stretches out to CI_Controller implies they can get to the strategies and factors characterized in the controller class.
$this loads perspectives, libraries and order the structure.
Create file in Views
Make a document named "hello_world.php". Spare this record in the View envelope of your CodeIgniter. Compose the accompanying coding.
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<p>Hello World!!</p>
</body>
</html>
Run the Controller document
To run the document, follow the way http://localhost/CodeIgniter/index.php/Hello/