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
@@ -415,7 +416,7 @@ To call the above controller your URI will look something like this::
415
416
Each of your sub-directories may contain a default controller which will be
416
417
called if the URL contains *only* the sub-directory. Simply put a controller
417
418
in there that matches the name of your default controller as specified in
418
-
your **app/Config/Routes.php** file.
419
+
your **app/Config/Routing.php** file.
419
420
420
421
CodeIgniter also permits you to map your URIs using its :ref:`Defined Route Routing <defined-route-routing>`..
421
422
@@ -546,24 +547,25 @@ Defining a Default Controller (Legacy)
546
547
547
548
Let's try it with the ``Helloworld`` controller.
548
549
549
-
To specify a default controller open your **app/Config/Routes.php**
550
-
file and set this variable:
550
+
To specify a default controller open your **app/Config/Routing.php**
551
+
file and set this property::
551
552
552
-
.. literalinclude:: controllers/015.php
553
+
public string $defaultController = 'Helloworld';
553
554
554
555
Where ``Helloworld`` is the name of the controller class you want to be used.
555
556
556
-
A few lines further down **Routes.php** in the "Route Definitions" section, comment out the line:
557
+
And comment out the line in **app/Config/Routes.php**:
557
558
558
559
.. literalinclude:: controllers/016.php
560
+
:lines: 2-
559
561
560
562
If you now browse to your site without specifying any URI segments you'll
561
563
see the "Hello World" message.
562
564
563
565
.. 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>`
564
566
565
-
For more information, please refer to the :ref:`routes-configuration-options` section of the
0 commit comments