<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome_message');
}
}
- Create a new PHP file and name it "Welcome.php".
- Place this file inside the "application/controllers" directory of your CodeIgniter project.
- Use the "defined('BASEPATH') OR exit('No direct script access allowed');" line to ensure that the file is accessed only through the CodeIgniter framework.
- Define a new class called "Welcome" that extends "CI_Controller".
- Inside the class, define a public method called "index".
- Within the "index" method, load the view file named "welcome_message" using "$this->load->view('welcome_message');".
- Save the file and the new controller is now ready for use within your CodeIgniter application.
```