函数原型:
wp_remote_retrieve_response_code( array|WP_Error $response ): int|string
从原始响应中获取响应代码。如果给定的参数值不正确,将返回一个空字符串。
函数源码:
function wp_remote_retrieve_response_code( $response ) {
if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) {
return '';
}
return $response['response']['code'];
}
使用举例:
$response = wp_remote_get( 'http://www.foo.com/file.txt' );
$response_code = wp_remote_retrieve_response_code( $response );
-
WordPress函数:esc_html_e 转义翻译的字符串并显示WordPress函数:esc_html_e 转义翻译的字符串并显示
-
WordPress函数:esc_html_x 带上下文的转义翻译WordPress函数:esc_html_x 带上下文的转义翻译
-
WordPress函数:esc_attr__ 转义属性及翻译WordPress函数:esc_attr__ 转义属性及翻译
-
WordPress函数:esc_attr_e 属性转义、翻译、显示WordPress函数:esc_attr_e 属性转义、翻译、显示
-
WordPress函数:esc_attr_x 带上下文的转义属性,翻译显示WordPress函数:esc_attr_x 带上下文的转义属性,翻译显示
-
WP Multilang WordPress翻译插件WP Multilang插件的主要功能是提供多语言支持,使用户能够创建多语言版本的网站,满足不同语言用户的需求。
暂无评论,抢个沙发...