Symfony\Component\HttpFoundation\Response::send PHP Method

send() public method

Sends HTTP headers and content.
public send ( ) : Response
return Response
    public function send()
    {
        $this->sendHeaders();
        $this->sendContent();

        if (function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        } elseif ('cli' !== PHP_SAPI) {
            static::closeOutputBuffers(0, true);
        }

        return $this;
    }

Usage Example

Exemplo n.º 1
0
 public function lastChangeTime()
 {
     $user = $this->user;
     $em = $this->em;
     $response = new Response();
     $currentCookieValue = 0;
     $currentTime = time();
     $maxTime = 60;
     $request = Request::createFromGlobals();
     $cookies = $request->cookies;
     if (!$cookies->has('lastChangeTime')) {
         $response->headers->setCookie(new Cookie('lastChangeTime', time(), time() + 3600 * 48));
         $response->send();
     } else {
         $currentCookieValue = $cookies->get('lastChangeTime');
     }
     if ($currentTime - $currentCookieValue > $maxTime) {
         $currentCookieValue = $currentTime;
         $response->headers->setCookie(new Cookie('lastChangeTime', $currentCookieValue, time() + 3600 * 48));
         $response->send();
         $user->setTime(time());
         $em->persist($user);
         $em->flush();
     }
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Response::send