Created
June 2, 2012 02:59
-
-
Save coreymcmahon/2856303 to your computer and use it in GitHub Desktop.
Using the Symfony 2 HTTP Foundation component - http://www.symfonycentral.com
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 | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
/* Using the HTTP Foundation class */ | |
$request = Request::createFromGlobals(); | |
$input = $request->get('name', 'World'); | |
$response = new Response('Hello ' . $input); | |
$response->send(); | |
/* ... instead of this: */ | |
$input = !empty($_GET['name']) ? $_GET['name'] : 'World'; | |
echo 'Hello ' . $input; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment