Learn CodeIgniter 4 Tutorials in Hindi - #3 Create Controllers & Configure Routes

Опубликовано: 13 Март 2026
на канале: Online Web Tutor Academy
2,450
34

In this video we'll see:

Learn CodeIgniter 4 Tutorials in Hindi - #3 Create Controllers & Configure Routes

#codeigniter4inhindi
#codeigniter4
#onlinewebtutor
#learncodeigniter4inhindi

About CodeIgniter 4 Controllers & Routes

Controllers act as glue code, marshaling data back and forth between the view (or the user that’s seeing it) and the data storage.

Controllers are typically stored in /app/Controllers

We can use the name of the Controller like
Site.php
SiteController.php

Basic code of a Controllers:
-----------------------------------------------
namespace App\Controllers;

class SiteController extends BaseController
{
public function test()
{
return view("site/test"); //views/site/test
}

public function aboutUs()
{
echo view("site/about-us");
}
}

While Defining Controllers we need extend Parent Controller as Base Controller

Routes in CodeIgniter 4
----------------------------------------------------------
Routes in CodeIgniter have gone through a pretty big upgrade from version 3 to 4.

Route Basics
As a refresher, in version 3 routes were specified in a simple array, where each key was the "URI from" and the value of the element was where it should be routed to. It was simple, elegant, worked great, and looked something like this:

$route['join'] = 'home/register';
$route['login'] = 'home/login';
$route['products/(:any)/details'] = 'products/show/$1';

Now in CodeIgniter 4 Routes can be created at app/Config/Routes.php

Some Examples of defining routes in that file

$routes-get('/', 'Home::index');
$routes-get("/test", "SiteController::test");
$routes-get("/about-us", "SiteController::aboutUs");
$routes-get("/contact-us", "First::contactUs");


SOCIAL :
===============
Subscribe :    / owthub  
FACEBOOK :   / owthub  
TWITTER:   / owthub  
BLOG: https://onlinewebtutorhub.blogspot.in/
UDEMY: https://www.udemy.com/user/online-web...

Channel Link of Official Online Web Tutor
   / onlinewebtutor  

WooCommerce Theme Development Tutorials(English):
https://bit.ly/2CAhUpT

Learn CodeIgniter v3.1.10(English):
https://bit.ly/32rRQsj

Learn CodeIgniter HMVC(English):
https://bit.ly/3fr4UBz

Tags:
===============
learn codeigniter 4 in hindi,
learn codeigniter 4 tutorials in hindi,
codeigniter 4 in hindi language,
codeigniter 4 tutorials in hindi,
step by step codeigniter 4 in hindi,
step by step codeigniter 4 tutorials in hindi,
codeigniter 4 tutorials 2020 in hindi,
online web tutor codeigniter 4


Thanks
Online Web Tutor Academy
Keep learning and Sharing :)