Skip to content

Commit c399d66

Browse files
committed
docs: move "Array Callable Syntax" up
1 parent 0ec5e71 commit c399d66

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

user_guide_src/source/incoming/routing.rst

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,32 @@ You can also specify the namespace with the ``namespace`` option:
9696

9797
See :ref:`assigning-namespace` for details.
9898

99+
Array Callable Syntax
100+
=====================
101+
102+
.. versionadded:: 4.2.0
103+
104+
Since v4.2.0, you can use array callable syntax to specify the controller:
105+
106+
.. literalinclude:: routing/013.php
107+
:lines: 2-
108+
109+
Or using ``use`` keyword:
110+
111+
.. literalinclude:: routing/014.php
112+
:lines: 2-
113+
114+
If there are placeholders, it will automatically set the parameters in the specified order:
115+
116+
.. literalinclude:: routing/015.php
117+
:lines: 2-
118+
119+
But the auto-configured parameters may not be correct if you use regular expressions in routes.
120+
In such a case, you can specify the parameters manually:
121+
122+
.. literalinclude:: routing/016.php
123+
:lines: 2-
124+
99125
Placeholders
100126
============
101127

@@ -147,33 +173,6 @@ routes. With the examples URLs from above:
147173

148174
will only match **product/123** and generate 404 errors for other example.
149175

150-
151-
Array Callable Syntax
152-
=====================
153-
154-
.. versionadded:: 4.2.0
155-
156-
Since v4.2.0, you can use array callable syntax to specify the controller:
157-
158-
.. literalinclude:: routing/013.php
159-
:lines: 2-
160-
161-
Or using ``use`` keyword:
162-
163-
.. literalinclude:: routing/014.php
164-
:lines: 2-
165-
166-
If there are placeholders, it will automatically set the parameters in the specified order:
167-
168-
.. literalinclude:: routing/015.php
169-
:lines: 2-
170-
171-
But the auto-configured parameters may not be correct if you use regular expressions in routes.
172-
In such a case, you can specify the parameters manually:
173-
174-
.. literalinclude:: routing/016.php
175-
:lines: 2-
176-
177176
Custom Placeholders
178177
===================
179178

0 commit comments

Comments
 (0)