wp_remote_retrieve_cookies

函式
wp_remote_retrieve_cookies ( $response )
引數
  • (array|WP_Error) $response HTTP response.
    Required:
返回值
  • (WP_Http_Cookie[]) An array of `WP_Http_Cookie` objects from the response. Empty array if there are none, or the response is a WP_Error.
定義位置
相關方法
wp_remote_retrieve_cookiewp_remote_retrieve_cookie_valuewp_remote_retrieve_bodywp_remote_retrieve_headerswp_remote_retrieve_header
引入
4.4.0
棄用
-

wp_remote_retrieve_cookies: 這個函式從通過wp_remote_request函式傳送的遠端HTTP請求的HTTP響應頭中檢索出一個cookie物件陣列。

僅從原始響應中獲取cookies。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_remote_retrieve_cookies( $response ) {
if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) {
return array();
}
return $response['cookies'];
}
function wp_remote_retrieve_cookies( $response ) { if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) { return array(); } return $response['cookies']; }
function wp_remote_retrieve_cookies( $response ) {
	if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) {
		return array();
	}

	return $response['cookies'];
}

常見問題

FAQs
檢視更多 >