Tutorial by Examples

Lets say we want to build a paginated list of products, where the number of the page is passed as a query string parameter. For instance, to fetch the 3rd page, you'd go to: http://example.com/products?page=3 The raw HTTP request would look something like this: GET /products?page=3 HTTP/1.1 Ho...
PHP exposes a number of so-called global variables which contain information about the HTTP request, such as $_POST, $_GET, $_FILES, $_SESSION, etc. The Request class contains a static createFromGlobals() method in order to instantiate a request object based on these variables: use Symfony\Componen...
To get the contents of a form that is submitted with method="post", use the post property: $name = $request->request->get('name');
$id = $request->cookies->get('PHPSESSID'); This will return the value of the 'PHPSESSID' cookie sent by the browser.

Page 1 of 1