WordPress开发者和主题制作者的搜索引擎



wp_get_http_headers ›

Since1.5.1
已弃用n/a
wp_get_http_headers ( $url, $deprecated = false )
参数: (2)
  • (string) $url URL to retrieve HTTP headers from.
    Required: Yes
  • (bool) $deprecated Not Used.
    Required: No
    默认: false
返回:
  • (bool|string) False on failure, headers on success.
定义在:
文档:

Retrieve HTTP Headers from URL.



源码

function wp_get_http_headers( $url, $deprecated = false ) {
	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '2.7.0' );
	}

	$response = wp_safe_remote_head( $url );

	if ( is_wp_error( $response ) ) {
		return false;
	}

	return wp_remote_retrieve_headers( $response );
}