Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ecd6be4

Browse filesBrowse files
committed
fixed markup
1 parent 0ca6251 commit ecd6be4
Copy full SHA for ecd6be4

File tree

Expand file treeCollapse file tree

1 file changed

+60
-60
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+60
-60
lines changed

‎components/http_foundation.rst

Copy file name to clipboardExpand all lines: components/http_foundation.rst
+60-60Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ The HttpFoundation Component
99
specification.
1010

1111
In PHP, the request is represented by some global variables (``$_GET``,
12-
``$_POST``, , ``$_FILE``, , ``$_COOKIE``, ``$_SESSION``...) and the response
13-
is generated by some functions (``echo``, ``header``, ``setcookie``, ...).
12+
``$_POST``, ``$_FILE``, ``$_COOKIE``, ``$_SESSION``...) and the response is
13+
generated by some functions (``echo``, ``header``, ``setcookie``, ...).
1414

1515
The Symfony2 HttpFoundation component replaces these default PHP global
1616
variables and functions by an Object-Oriented layer.
@@ -20,14 +20,14 @@ Request
2020

2121
The most common way to create request is to base it on the current PHP global
2222
variables with
23-
`:method:Symfony\\Component\\HttpFoundation\\Request::createFromGlobals()`::
23+
:method:`Symfony\\Component\\HttpFoundation\\Request::createFromGlobals()`::
2424

2525
use Symfony\Component\HttpFoundation\Request;
2626

2727
$request = Request::createFromGlobals();
2828

2929
which is almost equivalent to the more verbose, but also more flexible,
30-
`:method:Symfony\\Component\\HttpFoundation\\Request::__construct()` call::
30+
:method:`Symfony\\Component\\HttpFoundation\\Request::__construct()` call::
3131

3232
$request = new Request($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
3333

@@ -50,64 +50,64 @@ can be accessed via several public properties:
5050
* ``headers``: mostly equivalent to a sub-set of ``$_SERVER``
5151
(``$request->headers->get('Content-Type')``).
5252

53-
Each property is a `:class:Symfony\\Component\\HttpFoundation\\ParameterBag`
53+
Each property is a :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`
5454
instance (or a sub-class of), which is a data holder class:
5555

56-
* ``request``: `:class:Symfony\\Component\\HttpFoundation\\ParameterBag`;
56+
* ``request``: :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`;
5757

58-
* ``query``: `:class:Symfony\\Component\\HttpFoundation\\ParameterBag`;
58+
* ``query``: :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`;
5959

60-
* ``cookies``: `:class:Symfony\\Component\\HttpFoundation\\ParameterBag`;
60+
* ``cookies``: :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`;
6161

62-
* ``files``: `:class:Symfony\\Component\\HttpFoundation\\FileBag`;
62+
* ``files``: :class:`Symfony\\Component\\HttpFoundation\\FileBag`;
6363

64-
* ``server``: `:class:Symfony\\Component\\HttpFoundation\\ServerBag`;
64+
* ``server``: :class:`Symfony\\Component\\HttpFoundation\\ServerBag`;
6565

66-
* ``headers``: `:class:Symfony\\Component\\HttpFoundation\\HeaderBag`.
66+
* ``headers``: :class:`Symfony\\Component\\HttpFoundation\\HeaderBag`.
6767

68-
All `:class:Symfony\\Component\\HttpFoundation\\ParameterBag` instances have
68+
All :class:`Symfony\\Component\\HttpFoundation\\ParameterBag` instances have
6969
methods to retrieve and update its data:
7070

71-
* `:method:Symfony\\Component\\HttpFoundation\\ParameterBag::all()`: Returns
71+
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::all()`: Returns
7272
the parameters;
7373

74-
* `:method:Symfony\\Component\\HttpFoundation\\ParameterBagkeys()`: Returns
74+
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBagkeys()`: Returns
7575
the parameter keys;
7676

77-
* `:method:Symfony\\Component\\HttpFoundation\\ParameterBagreplace()`:
77+
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBagreplace()`:
7878
Replaces the current parameters by a new set;
7979

80-
* `:method:Symfony\\Component\\HttpFoundation\\ParameterBagadd()`: Adds
80+
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBagadd()`: Adds
8181
parameters;
8282

83-
* `:method:Symfony\\Component\\HttpFoundation\\ParameterBagget()`: Returns a
83+
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBagget()`: Returns a
8484
parameter by name;
8585

86-
* `:method:Symfony\\Component\\HttpFoundation\\ParameterBagset()`: Sets a
86+
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBagset()`: Sets a
8787
parameter by name;
8888

89-
* `:method:Symfony\\Component\\HttpFoundation\\ParameterBaghas()`: Returns
89+
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBaghas()`: Returns
9090
true if the parameter is defined;
9191

92-
* `:method:Symfony\\Component\\HttpFoundation\\ParameterBagremove()`: Removes
92+
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBagremove()`: Removes
9393
a parameter.
9494

95-
The `:class:Symfony\\Component\\HttpFoundation\\ParameterBag` instance also
95+
The :class:`Symfony\\Component\\HttpFoundation\\ParameterBag` instance also
9696
has some methods to filter the input values:
9797

98-
* `:method:Symfony\\Component\\HttpFoundation\\Request::getAlpha()`: Returns
98+
* :method:`Symfony\\Component\\HttpFoundation\\Request::getAlpha()`: Returns
9999
the alphabetic characters of the parameter value;
100100

101-
* `:method:Symfony\\Component\\HttpFoundation\\Request::getAlnum()`: Returns
101+
* :method:`Symfony\\Component\\HttpFoundation\\Request::getAlnum()`: Returns
102102
the alphabetic characters and digits of the parameter value;
103103

104-
* `:method:Symfony\\Component\\HttpFoundation\\Request::getDigits()`: Returns
104+
* :method:`Symfony\\Component\\HttpFoundation\\Request::getDigits()`: Returns
105105
the digits of the parameter value;
106106

107-
* `:method:Symfony\\Component\\HttpFoundation\\Request::getInt()`: Returns the
107+
* :method:`Symfony\\Component\\HttpFoundation\\Request::getInt()`: Returns the
108108
parameter value converted to integer;
109109

110-
* `:method:Symfony\\Component\\HttpFoundation\\Request::filter()`: Filters the
110+
* :method:`Symfony\\Component\\HttpFoundation\\Request::filter()`: Filters the
111111
parameter by using the PHP ``filter_var()`` function.
112112

113113
All getters takes up to three arguments: the first one is the parameter name
@@ -131,7 +131,7 @@ When PHP imports the request query, it handles request parameters like
131131
``foo`` parameter and you will get back an array with a ``bar`` element. But
132132
sometimes, you might want to get the value for the "original" parameter name:
133133
``foo[bar]``. This is possible with all the `ParameterBag` getters like
134-
`:method:Symfony\\Component\\HttpFoundation\\Request::get()` via the third
134+
:method:`Symfony\\Component\\HttpFoundation\\Request::get()` via the third
135135
argument::
136136

137137
// the query string is '?foo[bar]=bar'
@@ -147,7 +147,7 @@ argument::
147147

148148
Last, but not the least, you can also store additional data in the request,
149149
thanks to the ``attributes`` public property, which is also an instance of
150-
`:class:Symfony\\Component\\HttpFoundation\\ParameterBag`. This is mostly used
150+
:class:`Symfony\\Component\\HttpFoundation\\ParameterBag`. This is mostly used
151151
to attach information that belongs to the Request and that needs to be
152152
accessed from many different points in your application.
153153

@@ -156,7 +156,7 @@ Identifying a Request
156156

157157
In your application, you need a way to identify a request; most of the time,
158158
this is done via the "path info" of the request, which can be accessed via the
159-
`:method:Symfony\\Component\\HttpFoundation\\Request::getPathInfo()` method:
159+
:method:`Symfony\\Component\\HttpFoundation\\Request::getPathInfo()` method:
160160

161161
// for a request to http://example.com/blog/index.php/post/hello-world
162162
// the path info is "/post/hello-world"
@@ -170,31 +170,31 @@ a Request::
170170

171171
$request = Request::create('/hello-world', 'GET', array('name' => 'Fabien'));
172172

173-
The `:method:Symfony\\Component\\HttpFoundation\\Request::create()` method
173+
The :method:`Symfony\\Component\\HttpFoundation\\Request::create()` method
174174
creates a request based on a path info, a method and some parameters (the
175175
query parameters or the request ones depending on the HTTP method); and of
176176
course, you an also override all other variables as well (by default, Symfony
177177
creates sensible defaults for all the PHP global variables).
178178

179179
Based on such a request, you can override the PHP global variables via
180-
`:method:Symfony\\Component\\HttpFoundation\\Request::overrideGlobals()`::
180+
:method:`Symfony\\Component\\HttpFoundation\\Request::overrideGlobals()`::
181181

182182
$request->overrideGlobals();
183183

184184
.. tip::
185185

186186
You can also duplicate an existing query via
187-
`:method:Symfony\\Component\\HttpFoundation\\Request::duplicate()` or
187+
:method:`Symfony\\Component\\HttpFoundation\\Request::duplicate()` or
188188
change a bunch of parameters with a single call to
189-
`:method:Symfony\\Component\\HttpFoundation\\Request::initialize()`.
189+
:method:`Symfony\\Component\\HttpFoundation\\Request::initialize()`.
190190

191191
Accessing the Session
192192
~~~~~~~~~~~~~~~~~~~~~
193193

194194
If you have a session attached to the Request, you can access it via the
195-
`:method:Symfony\\Component\\HttpFoundation\\Request::getSession()` method;
195+
:method:`Symfony\\Component\\HttpFoundation\\Request::getSession()` method;
196196
the
197-
`:method:Symfony\\Component\\HttpFoundation\\Request::hasPreviousSession()`
197+
:method:`Symfony\\Component\\HttpFoundation\\Request::hasPreviousSession()`
198198
method tells you if the request contains a Session which was started in one of
199199
the previous requests.
200200

@@ -207,7 +207,7 @@ request information. Have a look at the API for more information about them.
207207
Response
208208
--------
209209

210-
A `:class:Symfony\\Component\\HttpFoundation\\Response` object holds all the
210+
A :class:`Symfony\\Component\\HttpFoundation\\Response` object holds all the
211211
information that needs to be sent back to the client from a given request. The
212212
constructor takes up to three arguments: the response content, the status
213213
code, and an array of HTTP headers::
@@ -227,7 +227,7 @@ These information can also be manipulated after the Response object creation::
227227

228228
When setting the ``Content-Type`` of the Response, you can set the charset,
229229
but it is better to set it via the
230-
`:method:Symfony\\Component\\HttpFoundation\\Response::setCharset()` method::
230+
:method:`Symfony\\Component\\HttpFoundation\\Response::setCharset()` method::
231231

232232
$response->setCharset('ISO-8859-1');
233233

@@ -239,12 +239,12 @@ Sending the Response
239239

240240
Before sending the Response, you can ensure that it is compliant with the HTTP
241241
specification by calling the
242-
`:method:Symfony\\Component\\HttpFoundation\\Response::prepare()` method::
242+
:method:`Symfony\\Component\\HttpFoundation\\Response::prepare()` method::
243243

244244
$response->prepare($request);
245245

246246
Sending the response to the client is then as simple as calling
247-
`:method:Symfony\\Component\\HttpFoundation\\Response::send()`:
247+
:method:`Symfony\\Component\\HttpFoundation\\Response::send()`:
248248

249249
$response->send();
250250

@@ -259,32 +259,32 @@ attribute::
259259
$response->headers->setCookie(new Cookie('foo', 'bar'));
260260

261261
The
262-
`:method:Symfony\\Component\\HttpFoundation\\ResponseHeaderBag::setCookie()`
262+
:method:`Symfony\\Component\\HttpFoundation\\ResponseHeaderBag::setCookie()`
263263
method takes an instance of
264-
`:class:Symfony\\Component\\HttpFoundation\\Cookie` as an argument.
264+
:class:`Symfony\\Component\\HttpFoundation\\Cookie` as an argument.
265265

266266
You can clear a cookie via the
267-
`:method:Symfony\\Component\\HttpFoundation\\Response::clearCookie()` method.
267+
:method:`Symfony\\Component\\HttpFoundation\\Response::clearCookie()` method.
268268

269269
Managing the HTTP Cache
270270
~~~~~~~~~~~~~~~~~~~~~~~
271271

272-
The `:class:Symfony\\Component\\HttpFoundation\\Response` class has a rich set
272+
The :class:`Symfony\\Component\\HttpFoundation\\Response` class has a rich set
273273
of methods to manipulate the HTTP headers related to the cache:
274274

275-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setPublic()`;
276-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setPrivate()`;
277-
* `:method:Symfony\\Component\\HttpFoundation\\Response::expire()`;
278-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setExpires()`;
279-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setMaxAge()`;
280-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setSharedMaxAge()`;
281-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setTtl()`;
282-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setClientTtl()`;
283-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setLastModified()`;
284-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setEtag()`;
285-
* `:method:Symfony\\Component\\HttpFoundation\\Response::setVary()`;
286-
287-
The `:method:Symfony\\Component\\HttpFoundation\\Response::setCache()` method
275+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setPublic()`;
276+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setPrivate()`;
277+
* :method:`Symfony\\Component\\HttpFoundation\\Response::expire()`;
278+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setExpires()`;
279+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setMaxAge()`;
280+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setSharedMaxAge()`;
281+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setTtl()`;
282+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setClientTtl()`;
283+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setLastModified()`;
284+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setEtag()`;
285+
* :method:`Symfony\\Component\\HttpFoundation\\Response::setVary()`;
286+
287+
The :method:`Symfony\\Component\\HttpFoundation\\Response::setCache()` method
288288
can be used to set the most commonly used cache information in one method
289289
call::
290290

@@ -299,7 +299,7 @@ call::
299299

300300
To check if the Response validators (``ETag``, ``Last-Modified``) match a
301301
conditional value specified in the client Request, use the
302-
`:method:Symfony\\Component\\HttpFoundation\\Response::isNotModified()`
302+
:method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified()`
303303
method::
304304

305305
if ($response->isNotModified($request)) {
@@ -313,7 +313,7 @@ Redirecting the User
313313
~~~~~~~~~~~~~~~~~~~~
314314

315315
To redirect the client to another URL, you can use the
316-
`:class:Symfony\\Component\\HttpFoundation\\RedirectResponse` class::
316+
:class:`Symfony\\Component\\HttpFoundation\\RedirectResponse` class::
317317

318318
use Symfony\Component\HttpFoundation\RedirectResponse;
319319

@@ -325,7 +325,7 @@ Streaming a Response
325325
.. versionadded:: 2.1
326326
Support for streamed responses was added in Symfony 2.1.
327327

328-
The `:class:Symfony\\Component\\HttpFoundation\\StreamedResponse` class allows
328+
The :class:`Symfony\\Component\\HttpFoundation\\StreamedResponse` class allows
329329
you to stream the Response back to the client. The response content is
330330
represented by a PHP callable instead of a string::
331331

@@ -350,7 +350,7 @@ Downloading Files
350350
When uploading a file, you must add a ``Content-Disposition`` header to your
351351
response. While creating this header for basic file downloads is easy, using
352352
non-ASCII filenames is more involving. The
353-
`:method::Symfony\\Component\\HttpFoundation\\Response:makeDisposition()`
353+
:method:`:Symfony\\Component\\HttpFoundation\\Response:makeDisposition()`
354354
abstracts the hard work behind a simple API::
355355

356356
use Symfony\\Component\\HttpFoundation\\ResponseHeaderBag;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.