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
Copy file name to clipboardExpand all lines: user_guide_src/source/incoming/routing.rst
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,8 @@ If you expect a GET request, you use the ``get()`` method:
31
31
32
32
.. literalinclude:: routing/001.php
33
33
34
-
A route takes the URI path (``/``) on the left, and maps it to the controller and method (``Home::index``) on the right,
34
+
A route takes the **Route Path** (URI path relative to the BaseURL. ``/``) on the left,
35
+
and maps it to the **Route Handler** (controller and method ``Home::index``) on the right,
35
36
along with any parameters that should be passed to the controller.
36
37
37
38
The controller and method should
@@ -320,22 +321,19 @@ define an array of routes and then pass it as the first parameter to the ``map()
320
321
Command-Line Only Routes
321
322
========================
322
323
324
+
.. note:: It is recommended to use Spark Commands for CLI scripts instead of calling controllers via CLI.
325
+
See the :doc:`../cli/cli_commands` page for detailed information.
326
+
323
327
You can create routes that work only from the command-line, and are inaccessible from the web browser, with the
324
328
``cli()`` method. Any route created by any of the HTTP-verb-based
325
329
route methods will also be inaccessible from the CLI, but routes created by the ``add()`` method will still be
326
330
available from the command line:
327
331
328
332
.. literalinclude:: routing/032.php
329
333
330
-
.. note:: It is recommended to use Spark Commands for CLI scripts instead of calling controllers via CLI.
331
-
See the :doc:`../cli/cli_commands` page for detailed information.
332
-
333
334
.. warning:: If you enable :ref:`auto-routing-legacy` and place the command file in **app/Controllers**,
334
335
anyone could access the command with the help of Auto Routing (Legacy) via HTTP.
335
336
336
-
.. note:: It is recommended to use Spark Commands instead of CLI routes.
337
-
See the :doc:`../cli/spark_commands` page for detailed information.
338
-
339
337
Global Options
340
338
**************
341
339
@@ -537,7 +535,7 @@ Route Priority
537
535
538
536
Routes are registered in the routing table in the order in which they are defined. This means that when a URI is accessed, the first matching route will be executed.
539
537
540
-
.. note:: If a route (the URI path) is defined more than once with different handlers, only the first defined route is registered.
538
+
.. warning:: If a route path is defined more than once with different handlers, only the first defined route is registered.
541
539
542
540
You can check registered routes in the routing table by running the :ref:`spark routes <routing-spark-routes>` command.
543
541
@@ -834,8 +832,8 @@ CodeIgniter has the following :doc:`command </cli/spark_commands>` to display al
834
832
835
833
.. _routing-spark-routes:
836
834
837
-
routes
838
-
======
835
+
spark routes
836
+
============
839
837
840
838
Displays all routes and filters::
841
839
@@ -854,9 +852,9 @@ The output is like the following:
854
852
855
853
The *Method* column shows the HTTP method that the route is listening for.
856
854
857
-
The *Route* column shows the route (URI path) to match. The route of a defined route is expressed as a regular expression.
855
+
The *Route* column shows the route path to match. The route of a defined route is expressed as a regular expression.
858
856
859
-
Since v4.3.0, the *Name* column shows the route name. ``»`` indicates the name is the same as the route.
857
+
Since v4.3.0, the *Name* column shows the route name. ``»`` indicates the name is the same as the route path.
860
858
861
859
.. important:: The system is not perfect. If you use Custom Placeholders, *Filters* might not be correct. If you want to check filters for a route, you can use :ref:`spark filter:check <spark-filter-check>` command.
862
860
@@ -877,6 +875,8 @@ The *Method* will be like ``GET(auto)``.
877
875
878
876
``/..`` in the *Route* column indicates one segment. ``[/..]`` indicates it is optional.
879
877
878
+
.. note:: When auto-routing is enabled and you have the route ``home``, it can be also accessed by ``Home``, or maybe by ``hOme``, ``hoMe``, ``HOME``, etc. but the command will show only ``home``.
879
+
880
880
If you see a route starting with ``x`` like the following, it indicates an invalid
881
881
route that won't be routed, but the controller has a public method for routing.
882
882
@@ -913,7 +913,7 @@ The *Method* will be ``auto``.
913
913
914
914
``[/...]`` in the *Route* column indicates any number of segments.
915
915
916
-
.. note:: When auto-routing is enabled, if you have the route ``home``, it can be also accessd by ``Home``, or maybe by ``hOme``, ``hoMe``, ``HOME``, etc. But the command shows only ``home``.
916
+
.. note:: When auto-routing is enabled and you have the route ``home``, it can be also accessed by ``Home``, or maybe by ``hOme``, ``hoMe``, ``HOME``, etc. but the command will show only ``home``.
0 commit comments