display_space_usage()

显示空间使用量

描述

显示当前站点使用的磁盘空间量。

用法

<?php display_space_usage(); ?>

参数

None.

示例

以下是使用 display_space_usage() 时输出的所有示例:

/* ———————————-
* wordpress函数 星空站长网收集
* ———————————- */

<strong>Used: 25% of 50MB</strong>
<strong>Used: 15% of 2GB</strong>

(注意:标签换行display_space_usage()显示的文本,在上面的示例中不是错误)

注意

据消息人士透露,此功能目前未在核心中使用。

历史

添加于 版本 3.0.0

源文件

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

/* ———————————-
* wordpress函数 Xingkongweb.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’ );

}

?>

<strong><?php printf(=“” __(=“” ‘used:=”” %1$s%%=”” of=”” %2$s’=“” ),=“” number_format(=“” $percent_used=“” ),=“” $space=“” );=“”?></strong>

<?php }=“”?>

相关

get_space_used(), get_space_allowed()

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索