wp_get_update_php_url

函式
wp_get_update_php_url ( No parameters )
返回值
  • (string) URL to learn more about updating PHP.
定義位置
相關方法
wp_get_update_https_urlwp_get_default_update_php_urlwp_get_direct_update_https_urlwp_get_default_update_https_urlwp_get_update_php_annotation
引入
5.1.0
棄用
-

wp_get_update_php_url: 這個函式檢索最新的可用PHP更新的URL。它返回一個包含最新PHP更新的URL的字串,可以用來下載更新。

獲取URL以瞭解更多關於更新網站執行的PHP版本。

這個URL可以通過指定環境變數`WP_UPDATE_PHP_URL`或使用{@see ‘wp_update_php_url’}過濾器來覆蓋。提供一個空字串是不允許的,這將導致使用預設的URL。此外,URL連結到的頁面最好是用網站語言進行本地化。

function wp_get_update_php_url() {
	$default_url = wp_get_default_update_php_url();

	$update_url = $default_url;
	if ( false !== getenv( 'WP_UPDATE_PHP_URL' ) ) {
		$update_url = getenv( 'WP_UPDATE_PHP_URL' );
	}

	/**
	 * Filters the URL to learn more about updating the PHP version the site is running on.
	 *
	 * Providing an empty string is not allowed and will result in the default URL being used. Furthermore
	 * the page the URL links to should preferably be localized in the site language.
	 *
	 * @since 5.1.0
	 *
	 * @param string $update_url URL to learn more about updating PHP.
	 */
	$update_url = apply_filters( 'wp_update_php_url', $update_url );

	if ( empty( $update_url ) ) {
		$update_url = $default_url;
	}

	return $update_url;
}

常見問題

FAQs
檢視更多 >