WP_HTTP_Requests_Response::get_headers() public WP 4.6.0
Retrieves headers associated with the response.
{} Это метод класса: WP_HTTP_Requests_Response{}
Хуков нет.
Возвращает
\Requests_Utility_CaseInsensitiveDictionary
. Map of header name to header value.
Использование
$WP_HTTP_Requests_Response = new WP_HTTP_Requests_Response(); $WP_HTTP_Requests_Response->get_headers();
Список изменений
С версии 4.6.0 | Введена. |
Код WP_HTTP_Requests_Response::get_headers() WP HTTP Requests Response::get headers WP 5.7.1
public function get_headers() {
// Ensure headers remain case-insensitive.
$converted = new Requests_Utility_CaseInsensitiveDictionary();
foreach ( $this->response->headers->getAll() as $key => $value ) {
if ( count( $value ) === 1 ) {
$converted[ $key ] = $value[0];
} else {
$converted[ $key ] = $value;
}
}
return $converted;
}