wp_remote_retrieve_body

函数
wp_remote_retrieve_body ( $response )
参数
  • (array|WP_Error) $response HTTP response.
    Required:
返回值
  • (string) The body of the response. Empty string if no body or incorrect parameter given.
定义位置
相关方法
wp_remote_retrieve_cookiewp_remote_retrieve_headerwp_remote_retrieve_headerswp_remote_retrieve_cookieswp_remote_retrieve_response_code
引入
2.7.0
弃用
-

wp_remote_retrieve_body: 这个函数检索通过wp_remote_request函数发送的远程HTTP请求的响应体。

从原始响应中只检索正文。

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

	return $response['body'];
}

常见问题

FAQs
查看更多 >