^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数get_core_checksums()用法示例

get_core_checksums( string $version,  string $locale )

Gets and caches the checksums for the given version of WordPress.


描述


参数

$version

(string)
(Required)
Version string to query.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包

$locale

(string)
(Required)
Locale to query.


返回值

(bool|array) False on failure. An array of checksums on success.


源代码

File: wp-admin/includes/update.php

function get_core_checksums( $version, $locale ) {
	$url = $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' );

	if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
		$url = set_url_scheme( $url, 'https' );

	$options = array(
		'timeout' => wp_doing_cron() ? 30 : 3,
	);

	$response = wp_remote_get( $url, $options );
	if ( $ssl && is_wp_error( $response ) ) {
		trigger_error(
			sprintf(
				/* translators: %s: support forums URL */
				__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
				__( 'https://wordpress.org/support/' )
			) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
			headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
		);
		$response = wp_remote_get( $http_url, $options );
	}

	if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
		return false;

	$body = trim( wp_remote_retrieve_body( $response ) );
	$body = json_decode( $body, true );

	if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) )
		return false;

	return $body['checksums'];
}

更新日志

Version 描述
3.7.0 Introduced.

相关函数

Uses

  • wp-includes/load.php:
    wp_doing_cron()
  • wp-includes/compat.php:
    json_decode()
  • wp-includes/l10n.php:
    __()
  • wp-includes/link-template.php:
    set_url_scheme()
  • wp-includes/http.php:
    wp_http_supports()
  • wp-includes/http.php:
    wp_remote_get()
  • wp-includes/http.php:
    wp_remote_retrieve_response_code()
  • wp-includes/http.php:
    wp_remote_retrieve_body()
  • wp-includes/load.php:
    is_wp_error()
  • Show 4 more uses


Used By

  • wp-admin/includes/class-core-upgrader.php:
    Core_Upgrader::check_files()
  • wp-admin/includes/update-core.php:
    update_core()

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈