public function Response::send

Sends HTTP headers and content.

@api

Return value

Response

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php, line 295

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function send() {
  $this
    ->sendHeaders();
  $this
    ->sendContent();
  if (function_exists('fastcgi_finish_request')) {
    fastcgi_finish_request();
  }
  elseif ('cli' !== PHP_SAPI) {

    // ob_get_level() never returns 0 on some Windows configurations, so if
    // the level is the same two times in a row, the loop should be stopped.
    $previous = null;
    $obStatus = ob_get_status(1);
    while (($level = ob_get_level()) > 0 && $level !== $previous) {
      $previous = $level;
      if ($obStatus[$level - 1] && isset($obStatus[$level - 1]['del']) && $obStatus[$level - 1]['del']) {
        ob_end_flush();
      }
    }
    flush();
  }
  return $this;
}