url_is_accessable_via_ssl

函式
url_is_accessable_via_ssl ( $url )
引數
  • (string) $url The URL to test.
    Required:
返回值
  • (bool) Whether SSL access is available.
定義位置
相關方法
rest_stabilize_valuewp_widgets_access_body_class_access_denied_splashfile_is_displayable_image
引入
2.5.0
棄用
4.0.0

url_is_accessable_via_ssl: 這個函式檢查一個URL是否可以通過SSL(安全套接字層)訪問。

確定URL是否可以通過SSL訪問。

通過使用WordPress的HTTP API訪問URL,確定是否可以通過SSL訪問該URL,使用https作為方案。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function url_is_accessable_via_ssl( $url ) {
_deprecated_function( __FUNCTION__, '4.0.0' );
$response = wp_remote_get( set_url_scheme( $url, 'https' ) );
if ( !is_wp_error( $response ) ) {
$status = wp_remote_retrieve_response_code( $response );
if ( 200 == $status || 401 == $status ) {
return true;
}
}
return false;
}
function url_is_accessable_via_ssl( $url ) { _deprecated_function( __FUNCTION__, '4.0.0' ); $response = wp_remote_get( set_url_scheme( $url, 'https' ) ); if ( !is_wp_error( $response ) ) { $status = wp_remote_retrieve_response_code( $response ); if ( 200 == $status || 401 == $status ) { return true; } } return false; }
function url_is_accessable_via_ssl( $url ) {
	_deprecated_function( __FUNCTION__, '4.0.0' );

	$response = wp_remote_get( set_url_scheme( $url, 'https' ) );

	if ( !is_wp_error( $response ) ) {
		$status = wp_remote_retrieve_response_code( $response );
		if ( 200 == $status || 401 == $status ) {
			return true;
		}
	}

	return false;
}

常見問題

FAQs
檢視更多 >