File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -1028,12 +1028,20 @@ a slash. URLs matching this route might look like:
1028
1028
1029
1029
This example also highlights the special ``_format `` routing parameter.
1030
1030
When using this parameter, the matched value becomes the "request format"
1031
- of the ``Request `` object. Ultimately, the request format is used for such
1032
- things as setting the ``Content-Type `` of the response (e.g. a ``json ``
1033
- request format translates into a ``Content-Type `` of ``application/json ``).
1034
- It can also be used in the controller to render a different template for
1035
- each value of ``_format ``. The ``_format `` parameter is a very powerful way
1036
- to render the same content in different formats.
1031
+ of the ``Request `` object.
1032
+
1033
+ Ultimately, the request format is used for such things as setting the
1034
+ ``Content-Type `` of the response (e.g. a ``json `` request format translates
1035
+ into a ``Content-Type `` of ``application/json ``). It can also be used in the
1036
+ controller to render a different template for each value of ``_format ``.
1037
+ The ``_format `` parameter is a very powerful way to render the same content
1038
+ in different formats.
1039
+
1040
+ In Symfony versions previous to 3.0, it is possible to override the request
1041
+ format by adding a query parameter named ``_format `` (for example:
1042
+ ``/foo/bar?_format=json ``). Relying on this behavior not only is considered
1043
+ a bad practice but it will complicate the upgrade of your applications to
1044
+ Symfony 3.
1037
1045
1038
1046
.. note ::
1039
1047
You can’t perform that action at this time.
0 commit comments