WordPress函数文档display_space_usage()
显示空间使用量 描述 Displays the amount of disk space used by th…
显示空间使用量
描述
Displays the amount of disk space used by the current site.
用法
<?php display_space_usage(); ?>
参数
None.
示例
The following are all examples of output when using display_space_usage():
1
2
3
4
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
<strong>Used: 25% of 50MB</strong>
|
1
2
3
4
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
<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)
注意
- According to the source, this function is not currently used in core.
历史
- 添加于 版本 3.0.0
源文件
display_space_usage() 函数的代码位于 wp-admin/includes/ms.php
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* 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’ );
}
?>
<strong><?php printf(=“” __(=“” ‘used:=”” %1$s%%=”” of=”” %2$s’=“” ),=“” number_format(=“” $percent_used=“” ),=“” $space=“” );=“”?></strong>
<?php }=“”?>
|
相关
get_space_used(), get_space_allowed()
- 原文:http://codex.wordpress.org/Function_Reference/display_space_usage
类别:WordPress函数文档、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!