Codeigniter 4 -Controller


A Controller is simply a class file that handles all http request.It is a part of MVC architecture

Create a file called as TestController.php

inside the folder app/Controllers/TestController.php and place the code below


namespace App\Controllers;
use CodeIgniter\Controller;

class TestController extends Controller
    public function index()
        echo 'Hello World!';


Make sure the class name and the file name should match.