@@ -79,8 +79,11 @@ You can supply multiple verbs that a route should match by passing them in as an
7979
8080.. literalinclude :: routing/004.php
8181
82+ Specifying Route Handlers
83+ =========================
84+
8285Controller's Namespace
83- ======================
86+ ----------------------
8487
8588If a controller name is stated without beginning with ``\ ``, the :ref: `routing-default-namespace ` will be prepended:
8689
@@ -97,7 +100,7 @@ You can also specify the namespace with the ``namespace`` option:
97100See :ref: `assigning-namespace ` for details.
98101
99102Array Callable Syntax
100- =====================
103+ ---------------------
101104
102105.. versionadded :: 4.2.0
103106
@@ -122,8 +125,20 @@ In such a case, you can specify the parameters manually:
122125.. literalinclude :: routing/016.php
123126 :lines: 2-
124127
128+ Using Closures
129+ --------------
130+
131+ You can use an anonymous function, or Closure, as the destination that a route maps to. This function will be
132+ executed when the user visits that URI. This is handy for quickly executing small tasks, or even just showing
133+ a simple view:
134+
135+ .. literalinclude :: routing/020.php
136+
137+ Specifying Route Paths
138+ ======================
139+
125140Placeholders
126- ============
141+ ------------
127142
128143A typical route might look something like this:
129144
@@ -174,7 +189,7 @@ routes. With the examples URLs from above:
174189will only match **product/123 ** and generate 404 errors for other example.
175190
176191Custom Placeholders
177- ===================
192+ -------------------
178193
179194You can create your own placeholders that can be used in your routes file to fully customize the experience
180195and readability.
@@ -186,7 +201,7 @@ This must be called before you add the route:
186201.. literalinclude :: routing/017.php
187202
188203Regular Expressions
189- ===================
204+ -------------------
190205
191206If you prefer you can use regular expressions to define your routing rules. Any valid regular expression
192207is allowed, as are back-references.
@@ -212,15 +227,6 @@ For those of you who don't know regular expressions and want to learn more about
212227
213228.. note :: You can also mix and match placeholders with regular expressions.
214229
215- Using Closures
216- ==============
217-
218- You can use an anonymous function, or Closure, as the destination that a route maps to. This function will be
219- executed when the user visits that URI. This is handy for quickly executing small tasks, or even just showing
220- a simple view:
221-
222- .. literalinclude :: routing/020.php
223-
224230.. _view-routes :
225231
226232View Routes
0 commit comments