Back to Browse

Learn CodeIgniter 4 Framework Tutorials #3 Create Controller & Configure Routes

5.6K views
Jul 14, 2020
12:15

In this video we'll see: Learn CodeIgniter 4 Framework Tutorials #3 Create Controller & Configure Routes 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"); #codeigniter4 #learncodeigniter4 #onlinewebtutor #codeigniter4Framework SOCIAL : =============== Subscribe : https://www.youtube.com/owthub FACEBOOK : https://www.facebook.com/owthub TWITTER: https://twitter.com/owthub BLOG: https://onlinewebtutorhub.blogspot.in/ UDEMY: https://www.udemy.com/user/online-web-tutor Other Tutorials =============== Wordpress Customizations: --------------------------------- Wordpress Theme (Hindi): https://goo.gl/MZ8maF Wordpress Widget (Hindi): https://goo.gl/Dc2htn Wordpress Plugin (English): https://goo.gl/BA7dYG Wordpress Theme Options (English): https://goo.gl/Vjv3Ub Wordpress JSON Rest API (English): https://goo.gl/SVQRQR Wordpress JSON Rest API (Hindi): https://goo.gl/NNWfKa and many more... Javascript framework: ---------------------------------- Learn backbone.js here! (English) : https://goo.gl/Qd2Pcs Learn Vue JS here ! (Hindi): https://goo.gl/MVtsmh PHP Frameworks: ---------------------------------- Laravel tutorial (Hindi): https://goo.gl/Nh9qJk CakePHP tutorial (Hindi): https://goo.gl/uRsS3G Tags: ---------------------------------- learn codeigniter 4, step by step codeigniter 4, codeigniter 4 tutorials, codeigniter 4 beginners tutorials, learn codeigniter 4 framework, learn codeigniter 4 step by step, codeigniter4, online web tutor codeigniter 4, codeigniter 4 framework, online web tutor Thanks Online Web Tutor Keep learning and Sharing :)

Download

1 formats

Video Formats

360pmp418.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Learn CodeIgniter 4 Framework Tutorials #3 Create Controller & Configure Routes | NatokHD