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
檢視更多 >