@@ -210,15 +210,6 @@ a simple view:
210
210
211
211
.. literalinclude :: routing/020.php
212
212
213
- Mapping Multiple Routes
214
- =======================
215
-
216
- While the ``add() `` method is simple to use, it is often handier to work with multiple routes at once, using
217
- the ``map() `` method. Instead of calling the ``add() `` method for each route that you need to add, you can
218
- define an array of routes and then pass it as the first parameter to the ``map() `` method:
219
-
220
- .. literalinclude :: routing/021.php
221
-
222
213
.. _redirecting-routes :
223
214
224
215
Redirecting Routes
@@ -319,20 +310,32 @@ This has the added benefit of making the views more readable, too.
319
310
Routes with any HTTP verbs
320
311
==========================
321
312
322
- It is possible to define a route with any HTTP verbs.
323
- You can use the ``add() `` method:
324
-
325
- .. literalinclude :: routing/031.php
326
-
327
313
.. warning :: While the ``add()`` method seems to be convenient, it is recommended to always use the HTTP-verb-based
328
314
routes, described above, as it is more secure. If you use the :doc: `CSRF protection </libraries/security >`, it does not protect **GET **
329
315
requests. If the URI specified in the ``add() `` method is accessible by the GET method, the CSRF protection
330
316
will not work.
331
317
318
+ It is possible to define a route with any HTTP verbs.
319
+ You can use the ``add() `` method:
320
+
321
+ .. literalinclude :: routing/031.php
322
+
332
323
.. note :: Using the HTTP-verb-based routes will also provide a slight performance increase, since
333
324
only routes that match the current request method are stored, resulting in fewer routes to scan through
334
325
when trying to find a match.
335
326
327
+ Mapping Multiple Routes
328
+ =======================
329
+
330
+ .. warning :: The ``map()`` method is not recommended as well as ``add()``
331
+ because it calls ``add() `` internally.
332
+
333
+ While the ``add() `` method is simple to use, it is often handier to work with multiple routes at once, using
334
+ the ``map() `` method. Instead of calling the ``add() `` method for each route that you need to add, you can
335
+ define an array of routes and then pass it as the first parameter to the ``map() `` method:
336
+
337
+ .. literalinclude :: routing/021.php
338
+
336
339
.. _command-line-only-routes :
337
340
338
341
Command-Line Only Routes
0 commit comments