wp_remote_get

函式
wp_remote_get ( $url, $args = array() )
引數
  • (string) $url URL to retrieve.
    Required:
  • (array) $args Optional. Request arguments. Default empty array.
    Required:
    Default: array()
返回值
  • (array|WP_Error) The response or WP_Error on failure.
相關
  • wp_remote_request()
  • WP_Http::request()
定義位置
相關方法
wp_safe_remote_getwp_remote_postwp_remote_headwp_remote_requestwp_remote_fopen
引入
2.7.0
棄用
-

wp_remote_get: 這個函式用來通過HTTP GET檢索一個遠端檔案的內容。它接受一個單一的引數:遠端檔案的URL。

使用GET方法執行一個HTTP請求並返回其響應。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_remote_get( $url, $args = array() ) {
$http = _wp_http_get_object();
return $http->get( $url, $args );
}
function wp_remote_get( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->get( $url, $args ); }
function wp_remote_get( $url, $args = array() ) {
	$http = _wp_http_get_object();
	return $http->get( $url, $args );
}

常見問題

FAQs
檢視更多 >