wp_http_supports
函数
wp_http_supports ( $capabilities = array(), $url = null )
- 参数
-
-
(array)
$capabilities
Array of capabilities to test or a wp_remote_request() $args array.- Required: 否
- Default: array()
-
(string)
$url
Optional. If given, will check if the URL requires SSL and adds that requirement to the capabilities array.- Required: 否
- Default: null
-
(array)
- 返回值
-
- (bool)
- 定义位置
-
-
wp-includes/http.php
, line 367
-
wp-includes/http.php
- 引入
- 3.2.0
- 弃用
- –
确定是否有一个可以处理此请求的HTTP传输。
function wp_http_supports( $capabilities = array(), $url = null ) { $http = _wp_http_get_object(); $capabilities = wp_parse_args( $capabilities ); $count = count( $capabilities ); // If we have a numeric $capabilities array, spoof a wp_remote_request() associative $args array. if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) == $count ) { $capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) ); } if ( $url && ! isset( $capabilities['ssl'] ) ) { $scheme = parse_url( $url, PHP_URL_SCHEME ); if ( 'https' === $scheme || 'ssl' === $scheme ) { $capabilities['ssl'] = true; } } return (bool) $http->_get_first_available_transport( $capabilities ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。