WpOrg\Requests\Response

Headers::offsetGet()publicWP 1.0

Get the given header

Unlike \WpOrg\Requests\Response\Headers::getValues(), this returns a string. If there are multiple values, it concatenates them with a comma as per RFC2616.

Avoid using this where commas may be used unquoted in values, such as Set-Cookie headers.

Метод класса: Headers{}

Хуков нет.

Возвращает

Строку|null. Header value

Использование

$Headers = new Headers();
$Headers->offsetGet( $offset );
$offset(строка) (обязательный)
Name of the header to retrieve.

Код Headers::offsetGet() WP 6.6.2

public function offsetGet($offset) {
	if (is_string($offset)) {
		$offset = strtolower($offset);
	}

	if (!isset($this->data[$offset])) {
		return null;
	}

	return $this->flatten($this->data[$offset]);
}