Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
wp_remote_retrieve_header() - 从原始响应中按名称检索单个header - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / wp_remote_retrieve_header()

wp_remote_retrieve_header( array|WP_Error $response, string $header )

从原始响应中按名称检索单个header


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 4 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "ad136aa67883594a06876e6ad38e8a8c" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "006cf7a66a945a4c149a101c5a5d49e1" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "034c4aafb381bf888f2199e32a8c35a5" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

headermore...

remote 远程

retrieve


参数

$response

(array|WP_Error)(必填) HTTP响应。

$header

(string)(必填) 要从中检索值的header名称。


返回

(array|string) header值,如果检索到具有相同名称的多个header,则返回数组。如果给定的参数不正确或header不存在,则为空字符串。



源码

查看源码 官方文档


更新日志

版本描述
2.7.0开始引入

使用示例

  • 示例1

    从响应header获取最后修改日期

    $response = wp_remote_get( 'http://www.foo.com/file.txt' );
    $last_modified = wp_remote_retrieve_header( $response, 'last-modified' );