First code in php codeigniter
How to run code in the framework Codeigniter. Below I have provided step by step procedure so don't worry let's begin.
Step 1: Create controller code-named this file as "First.php"
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class First extends CI_Controller {
public function index()
{
$this->load->view('first_view');
}
}
Step 2: Now create a view with the name "first_view.php".
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<p>Hello World!!</p>
</body>
</html>
Now you can run this file by giving the URL
"http://localhost/code/index.php/First"
Note: here "code" is my folder name, index.php is the default file without which we cannot access our file and "First" is our controller name.

.png)
Comments
Post a Comment