仅检索原始响应中的标头。
原型
wp_remote_retrieve_headers( array $response )
参数
$response
(array)
(Required)
HTTP响应。
返回值
(array|Requests_Utility_CaseInsensitiveDictionary)
响应的标头。如果给出错误参数,则为空数组
源文件
路径:wp-includes/http.php
<?php
...
function wp_remote_retrieve_headers( $response ) {
if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {
return array();
}
return $response['headers'];
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_remote_retrieve_headers/