src/Leevel/Http/Response.php
public function sendHeaders(): IResponse
    {
        if (headers_sent()) {
            return $this;
        }

        // @codeCoverageIgnoreStart
        foreach ($this->headers->all() as $name => $value) {
            header($name.': '.$value, false, $this->statusCode);
        }

        // 状态码
        header(sprintf('HTTP/%s %s %s', $this->protocolVersion, $this->statusCode, $this->statusText), true, $this->statusCode);

        // COOKIE
        foreach ($this->getCookies() as $item) {
            call_user_func_array('setcookie', $item);
        }

        return $this;
        // @codeCoverageIgnoreEnd
    }
public function sendHeaders(): IResponse
    {
        if (headers_sent()) {
            return $this;
        }

        // @codeCoverageIgnoreStart
        foreach ($this->headers->all() as $name => $value) {
            header($name.': '.$value, false, $this->statusCode);
        }

        // 状态码
        header(sprintf('HTTP/%s %s %s', $this->protocolVersion, $this->statusCode, $this->statusText), true, $this->statusCode);

        // COOKIE
        foreach ($this->getCookies() as $item) {
            call_user_func_array('setcookie', $item);
        }

        return $this;
        // @codeCoverageIgnoreEnd
    }
发送响应头.

@return $this