src/Response.php
public function headers($name = null, $value = null)
    {
        if (is_array($name))
        {
            foreach ($name as $k => $v)
            {
                $this->message->withHeader($k, $v);
            }
            return $this;
        }

        if (null === $name)
        {
            return $this->message->getHeaders();
        }
        elseif (null === $value)
        {
            return $this->message->getHeaderLine($name);
        }

        $this->message->withHeader($name, $value);

        return $this;
    }
public function headers($name = null, $value = null)
    {
        if (is_array($name))
        {
            foreach ($name as $k => $v)
            {
                $this->message->withHeader($k, $v);
            }
            return $this;
        }

        if (null === $name)
        {
            return $this->message->getHeaders();
        }
        elseif (null === $value)
        {
            return $this->message->getHeaderLine($name);
        }

        $this->message->withHeader($name, $value);

        return $this;
    }
输出header信息

// 获取指定头信息
$accept = $response->headers('Content-Type');

// 设置头信息
$response->headers('Content-Type', 'text/html');

// 获取所有头信息
$headers = $response->headers();

// 一次设置多个头信息
$response->headers(['Content-Type' => 'text/html', 'Cache-Control' => 'no-cache']);

@param mixed  $name
@param string $value
@return mixed