Last active
February 17, 2018 19:42
-
-
Save rodrigoSyscop/8b41eb28a6add73b798ea02bcfb53aa3 to your computer and use it in GitHub Desktop.
Http Foundation Request API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // a URI requisitada (ex: /about) menos a query string | |
| $request->getPathInfo(); | |
| // recebe variáveis GET['foo'] e POST['bar'] respectivamente | |
| $request->query->get('foo'); | |
| $request->request->get('bar', 'valor padrão, caso "bar" no exista'); | |
| // recebe variáveis do array $_SERVER | |
| $request->server->get('HTTP_HOST'); | |
| // recebe uma instância de UploadedFile identificado por foo | |
| $request->files->get('foo'); | |
| // recebe o valor de um COOKIE | |
| $request->cookies->get('PHPSESSID'); | |
| // recebe um cabeçalho HTTP, com as chaves normalizadas em minúsculas | |
| $request->headers->get('host'); | |
| $request->headers->get('content_type'); | |
| $request->getMethod(); // GET, POST, PUT, DELETE, HEAD | |
| $request->getLanguages(); // um array com as linguagens aceitas pelo cliente | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment