You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -427,7 +428,7 @@ To call the above controller your URI will look something like this::
427
428
Each of your sub-directories may contain a default controller which will be
428
429
called if the URL contains *only* the sub-directory. Simply put a controller
429
430
in there that matches the name of your default controller as specified in
430
-
your **app/Config/Routes.php** file.
431
+
your **app/Config/Routing.php** file.
431
432
432
433
CodeIgniter also permits you to map your URIs using its :ref:`Defined Route Routing <defined-route-routing>`..
433
434
@@ -590,24 +591,25 @@ Defining a Default Controller (Legacy)
590
591
591
592
Let's try it with the ``Helloworld`` controller.
592
593
593
-
To specify a default controller open your **app/Config/Routes.php**
594
-
file and set this variable:
594
+
To specify a default controller open your **app/Config/Routing.php**
595
+
file and set this property::
595
596
596
-
.. literalinclude:: controllers/015.php
597
+
public string $defaultController = 'Helloworld';
597
598
598
599
Where ``Helloworld`` is the name of the controller class you want to be used.
599
600
600
-
A few lines further down **Routes.php** in the "Route Definitions" section, comment out the line:
601
+
And comment out the line in **app/Config/Routes.php**:
601
602
602
603
.. literalinclude:: controllers/016.php
604
+
:lines: 2-
603
605
604
606
If you now browse to your site without specifying any URI segments you'll
605
607
see the "Hello World" message.
606
608
607
609
.. note:: The line ``$routes->get('/', 'Home::index');`` is an optimization that you will want to use in a "real-world" app. But for demonstration purposes we don't want to use that feature. ``$routes->get()`` is explained in :doc:`URI Routing <routing>`
608
610
609
-
For more information, please refer to the :ref:`routes-configuration-options` section of the
0 commit comments