display_space_usage()显示空间使用量

目录

描述

Displays the amount of disk space used by the current site.

display_space_usage() 描述

用法

<?php display_space_usage(); ?>

display_space_usage() 用法

参数

None.

display_space_usage() 参数

示例

The following are all examples of output when using display_space_usage():

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
<strong>Used: 25% of 50MB</strong>
/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
<strong>Used: 15% of 2GB</strong>

(Note: The <strong> tags wrap the text displayed by display_space_usage() and are not an error in the examples above)

display_space_usage() 示例

注意

  • According to the source, this function is not currently used in core.

display_space_usage() 注意

历史

display_space_usage() 历史

源文件

display_space_usage() 函数的代码位于 wp-admin/includes/ms.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Displays the amount of disk space used by the current blog. Not used in core.
 *
 * @since MU
 */
function display_space_usage() {
	$space_allowed = get_space_allowed();
	$space_used = get_space_used();

	$percent_used = ( $space_used / $space_allowed ) * 100;

	if ( $space_allowed > 1000 ) {
		$space = number_format( $space_allowed / 1024 );
		/* translators: Gigabytes */
		$space .= __( 'GB' );
	} else {
		$space = number_format( $space_allowed );
		/* translators: Megabytes */
		$space .= __( 'MB' );
	}
	?>
	
	

display_space_usage() 源文件

相关