create controller codeigniter 3

defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends CI_Controller {

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