CodeIgniter 4 from Scratch – #5 – Routes



In this video of CodeIgniter 4 From Scratch Series we will see how we can manage our routes. We will take a look at Routes.php file that holds our navigation logic.

Quick overview of what to expect in this video:
– How to manage our routes
– How to define custom routes
– How to create a group of route
– How to add a route based on the HTTP request type

CodeIgniter 4 From Scratch Series, the series that are intended to help you get started with CodeIgniter 4 even if you have never worked with PHP frameworks before.

This course will not only help you get started with CodeIgniter but also will help you understand the way PHP Frameworks work.

For more information about Codeigniter 4 Routing read the official docs


Nguồn: https://rmacct.org/

Xem thêm bài viết khác: https://rmacct.org/cong-nghe/

  • Hi bro, please look at this problem I have …

    When I use placeholer in the routes for sub-folder it doesn't work:

    $routes->get('cerrar-jornada/(:any)', 'admin/Jornada::cerrarJornada/$1');
    respond with>>>//404 – File Not Found
    //Controller or its method is not found: AppControllersadmin::index
    this work:
    $routes->get('cerrar-jornada', 'admin/Jornada::cerrarJornada');

    Jose Chirino July 5, 2020 3:57 am Reply
  • I got the problem with default value of function:
    – My controller:
    public function teaching($subject = "CI4") {
    return "I am teaching : " . $subject;
    }
    – My routes
    $routes->add('teach/(:any)', 'Teacher::teaching/$1')

    It fine if I pass the parameter localhost:8080/teach/ci4
    but it will error when i don't pass the parameter localhost:8080/teach

    rady bmcs July 5, 2020 3:57 am Reply
  • Great video, everything well explained. Thanks

    Jose Chirino July 5, 2020 3:57 am Reply
  • Nice tutorial Alex! But do we have to add routes for every method that we have?

    Tony Hermawan Widjanarko July 5, 2020 3:57 am Reply
  • Hi Alex, after I submitted the post form it displays object not found. I'm stuck here. can you help me?

    Clara Lugtu July 5, 2020 3:57 am Reply
  • thanks Alex …. so what the diffirent between add and get in the route file

    Chaker 7 July 5, 2020 3:57 am Reply
  • Will you talk about multilingual apps in the future? I wonder what is the proper way of routing that in CodeIgniter 4.

    SilverBlaidd July 5, 2020 3:57 am Reply
  • Hi, Alex great tutorial. One question regarding controllers. You seem to be creating controllers by duplicating default one and that uses AppControllersBaseController, in the docs however they tell you to create controller using AppControllersController what is the difference if any?

    Bartlomiej Przymus July 5, 2020 3:57 am Reply

Leave a Reply

Your email address will not be published. Required fields are marked *