设置响应头
@param  array|string $header 多个头或单个头
@return object               自身
545388
public function withHeader($header): object
    {
        if (is_array($header)) {
            foreach ($header as $value) {
                header($value);
            }
        } else {
            header($header);
        }
        return $this;
    }
1272098
public function fileHeader($header)
    {
        $this->fileHeader = is_array($header) ? implode("\n", $header) : (string)$header;
        return $this;
    }
906826
protected function call($request, $header)
    {
        if (empty($request['call']))
        {
            return array('errno' => self::ERR_PARAMS);
        }
        /**
         * 侦测服务器是否存活
         */
        if ($request['call'] === 'PING')
        {
            return array('errno' => 0, 'data' => 'PONG');
        }
        //验证客户端IP是否被允许访问
        if ($this->verifyIp)
        {
            if (!$this->verifyIp(self::$clientEnv['_socket']['remote_ip']))
            {
                return array('errno' => self::ERR_ACCESS_DENY);
            }
        }
        //验证密码是否正确
        if ($this->verifyUser)
        {
            if (empty(self::$clientEnv['user']) or empty(self::$clientEnv['password']))
            {
                fail:
                return array('errno' => self::ERR_USER);
            }
            if (!$this->verifyUser(self::$clientEnv['user'], self::$clientEnv['password']))
            {
                goto fail;
            }
        }
        //函数不存在
        if (!is_callable($request['call']))
        {
            return array('errno' => self::ERR_NOFUNC);
        }
        //前置方法
        if (method_exists($this, 'beforeRequest'))
        {
            $this->beforeRequest($request);
        }
        //调用接口方法
        $ret = call_user_func_array($request['call'], $request['params']);
        //后置方法
        if (method_exists($this, 'afterRequest'))
        {
            $this->afterRequest($ret);
        }
        //禁止接口返回NULL，客户端得到NULL时认为RPC调用失败
        if ($ret === NULL)
        {
            return array('errno' => self::ERR_CALL);
        }
        return array('errno' => 0, 'data' => $ret);
    }
344418
public function addHeader($header){
		$headerO=$header;
		if(\is_string($header)){
			$headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div");
			$headerO->setClass("header");
			$headerO->setContent($header);
		}
		return $this->addContent($headerO,true);
	}
63635
public static function decode($header)
    {
        $data = [
            'realm'    => null,
            'username' => null,
            'uri'      => null,
            'nonce'    => null,
            'opaque'   => null,
            'qop'      => null,
            'cnonce'   => null,
            'nc'       => null,
            'response' => null
        ];
        $keys = implode('|', array_keys($data));
        $regex = '~(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))~';
        preg_match_all($regex, $header, $matches, PREG_SET_ORDER);

        foreach ($matches as $m) {
            $data[$m[1]] = $m[3] ? $m[3] : $m[4];
        }
        return $data;
    }
876027
protected function computeHeader(array $header)
    {
        if ([] === $header) {
            $header = $this->getHeader();
        }

        if ($header === array_unique(array_filter($header, 'is_string'))) {
            return $header;
        }

        throw new Exception('The header record must be empty or a flat array with unique string values');
    }
835463
public function addHeader($header)
	{
		if(is_string($header)) $header = HeaderField::fromString($header);
		$this->_headers[] = $header;
		return $this;
	}
163440
public static function getHeaderStatus(string $header): string
    {
        $pos = strpos($header, "\r\n");

        return $pos === false ? '' : substr($header, 0, $pos);
    }
418612
public function withoutHeader($header)
    {
        if ($this->complete) {
            return $this;
        }

        $new = $this->psrResponse->withoutHeader($header);
        return new self($new);
    }
432526
public function deserialize($header)
    {
        if (preg_match(self::CONTEXT_HEADER_FORMAT, $header, $matches)) {
            if ($matches[1] == "00") {
                return $this->deserializeVersion0($matches[2]);
            } else {
                trigger_error("Unrecognized SpanContext header version: " . $matches[1], E_USER_WARNING);
            }
        }
        return new SpanContext();
    }
82197
public static function getHeader($header, $default = null)
    {
        $header  = strtolower($header);
        $headers = self::getInstance()->getHeaders();
        $headers = array_change_key_case($headers, CASE_LOWER);
        if (array_key_exists($header, $headers)) {
            $value = \is_array($headers[$header]) ? implode(', ', $headers[$header]) : $headers[$header];
            return $value;
        }
        return $default;
    }
568119
private function curlHeader($ch, $header) {
    $this->response['raw'] .= $header;

    list($key, $value) = array_pad(explode(':', $header, 2), 2, null);

    $key = trim($key);
    $value = trim($value);

    if ( ! isset($this->response['headers'][$key])) {
      $this->response['headers'][$key] = $value;
    } else {
      if (!is_array($this->response['headers'][$key])) {
        $this->response['headers'][$key] = array($this->response['headers'][$key]);
      }
      $this->response['headers'][$key][] = $value;
    }

    return strlen($header);
  }
288211
private function parseHeader($header)
    {
        $res = preg_match_all('/(?:[^,"]*+(?:"[^"]*+")?)+[^,"]*+/', $header, $matches);

        if (!$res) {
            throw new InvalidHeader(sprintf('Failed to parse accept header: "%s"', $header));
        }

        return array_values(array_filter(array_map('trim', $matches[0])));
    }
942018
public function removeHeader($header)
    {
        if (\is_string($header)) {
            if (\array_key_exists($header, $this->_config['headers'])) {
                unset($this->_config['headers'][$header]);
            }
        } else {
            throw new InvalidException('Header must be a string');
        }

        return $this;
    }
892610
public function getHeader($header)
    {
        $header = ucwords(strtolower($header));
        if (! is_string($header) || ! isset($this->headers[$header])) return null;

        return $this->headers[$header];
    }
607787
public static function parse($header)
    {
        if (strpos($header, '=') === false) {
            $header = '='.$header;
        }

        list($name, $header) = explode('=', $header, 2);

        if (strpos($header, ';') === false) {
            $value = $header;
            $header = null;
        } else {
            list($value, $header) = explode(';', $header, 2);
        }

        $attributes = [];
        foreach (array_map('trim', explode(';', $header)) as $pair) {
            if (empty($pair)) {
                continue;
            }

            if (strpos($pair, '=') === false) {
                $attributeName = $pair;
                $attributeValue = null;
            } else {
                list($attributeName, $attributeValue) = explode('=', $pair);
            }

            $attributes[trim($attributeName)] = $attributeValue ? trim($attributeValue) : true;
        }

        $name = trim($name);
        $value = trim($value);

        return [!empty($name) ? $name : null, !empty($value) ? $value : null, $attributes];
    }
536362
public function getRequestHeader($header, $default = false)
    {
        if ($this->hasRequestHeader($header)) {
            $headers = $this->getAllRequestHeaders();
            return $headers[$header];
        } else {
            return $default;
        }
    }