$request = sfContext::getInstance()->getRequest(); echo $request->getParameter('name');
$user = sfContext::getInstance()->getUser(); if ($user->isAuthenticated()) { echo "Welcome " . $user->getUsername(); } else { echo "Please log in."; }
$response = sfContext::getInstance()->getResponse(); $response->setStatusCode(404); $response->setContent("Page not found."); $response->send();This code retrieves the current response object and sets its status code to 404 (not found), sets the content of the response to a message, and sends the response to the browser. Overall, the sfContext class provides a convenient and easy way to access important core objects in the Symfony framework.