Created
August 27, 2015 04:29
-
-
Save sword-jin/448e552891b3c4683220 to your computer and use it in GitHub Desktop.
Symfony Http-Component
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
use Symfony\Component\HttpFoundation\Request; | |
$request = Request::createFromGlobals(); | |
// the URI being requested (e.g. /about) minus any query parameters | |
$request->getPathInfo(); | |
// retrieve GET and POST variables respectively | |
$request->query->get('foo'); | |
$request->request->get('bar', 'default value if bar does not exist'); | |
// retrieve SERVER variables | |
$request->server->get('HTTP_HOST'); | |
// retrieves an instance of UploadedFile identified by foo | |
$request->files->get('foo'); | |
// retrieve a COOKIE value | |
$request->cookies->get('PHPSESSID'); | |
// retrieve an HTTP request header, with normalized, lowercase keys | |
$request->headers->get('host'); | |
$request->headers->get('content_type'); | |
$request->getMethod(); // GET, POST, PUT, DELETE, HEAD | |
$request->getLanguages(); // an array of languages the client accepts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment