wp_remote_retrieve_response_message

函数
wp_remote_retrieve_response_message ( $response )
参数
  • (array|WP_Error) $response HTTP response.
    Required:
返回值
  • (string) The response message. Empty string if incorrect parameter given.
定义位置
相关方法
wp_remote_retrieve_response_codewp_remote_retrieve_headerwp_remote_retrieve_cookie_valuewp_remote_retrieve_headerswp_remote_retrieve_cookie
引入
2.7.0
弃用
-

wp_remote_retrieve_response_message: 这个函数从通过wp_remote_request函数发送的远程HTTP请求的HTTP响应头中检索HTTP响应信息。

只从原始响应中获取响应信息。

如果给定的参数值不正确,将返回一个空字符串。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_remote_retrieve_response_message( $response ) {
if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) {
return '';
}
return $response['response']['message'];
}
function wp_remote_retrieve_response_message( $response ) { if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) { return ''; } return $response['response']['message']; }
function wp_remote_retrieve_response_message( $response ) {
	if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) {
		return '';
	}

	return $response['response']['message'];
}

常见问题

FAQs
查看更多 >