本文整理汇总了PHP中Formatter::fileSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::fileSize方法的具体用法?PHP Formatter::fileSize怎么用?PHP Formatter::fileSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter::fileSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFileSize
/**
* @todo Implement testFileSize().
*/
public function testFileSize()
{
$this->assertEquals('0 B', Formatter::fileSize(0));
$this->assertEquals('1.00 KiB', Formatter::fileSize(1000));
$this->assertEquals('1.02 KiB', Formatter::fileSize(1024));
// Test fails due to floating point precision?
//$this->assertEquals('1.03 KiB', Formatter::fileSize(1025));
$this->assertEquals('1.03 KiB', Formatter::fileSize(1025.1));
$this->assertEquals('1.00 MiB', Formatter::fileSize(1000000));
$this->assertEquals('1.00 GiB', Formatter::fileSize(1000000000));
$this->assertEquals('1.00 TiB', Formatter::fileSize(1000000000000));
$this->assertEquals('1.00 PiB', Formatter::fileSize(1000000000000000));
}
示例2: getMaxUploadSize
/**
* Returns the maximum filesize to upload
*
* @param bool return as formatted string
* @return mixed
*/
public static function getMaxUploadSize($_asString = false, $_value = null)
{
$maxUpload = ConfigUtil::ini2bytes(ini_get("upload_max_filesize"));
$maxPost = ConfigUtil::ini2bytes(ini_get("post_max_size"));
if ($_value != null) {
if ($_value < $maxUpload) {
$maxUpload = $_value;
}
if ($_value < $maxPost) {
$maxPost = $_value;
}
}
if ($maxPost < $maxUpload) {
$maxUpload = $maxPost;
}
if ($_asString) {
return Formatter::fileSize($maxUpload);
} else {
return $maxUpload;
}
}
示例3: array
<th colspan="8"><?php
echo Yii::t('core', 'amountTables', array($tableCount, '{amount} ' => $tableCount));
?>
</th>
<th><?php
echo $totalRowCount;
?>
</th>
<th></th>
<th></th>
<th style="text-align: right"><?php
echo Formatter::fileSize($totalDataLength);
?>
</th>
<th style="text-align: right"><?php
echo Formatter::fileSize($totalDataFree);
?>
</th>
</tr>
</tfoot>
</table>
<div class="buttonContainer">
<div class="left withSelected">
<span class="icon">
<?php
echo Html::icon('arrow_turn_090');
?>
<span><?php
echo Yii::t('core', 'withSelected');
?>
示例4: elseif
echo $model->schema;
?>
'})">
<?php
echo Html::icon('save');
?>
<?php
echo Formatter::fileSize(strlen($value));
?>
</a>
<?php
} else {
?>
<?php
echo Formatter::fileSize(strlen($value));
?>
<?php
}
?>
<?php
} elseif ($model->table !== null) {
?>
<span><?php
echo is_null($value) ? '<span class="null">NULL</span>' : (Yii::app()->user->settings->get('showFullColumnContent', 'schema.table.browse', $model->schema . '.' . $model->table) ? htmlspecialchars($value) : StringUtil::cutText(htmlspecialchars($value), 100));
?>
</span>
<?php
} else {
?>
<span><?php
示例5:
<td><?php
echo Yii::t('core', 'averageRowLength');
?>
</td>
<td><?php
echo $table->AVG_ROW_LENGTH;
?>
</td>
</tr>
<tr>
<td><?php
echo Yii::t('core', 'averageRowSize');
?>
</td>
<td><?php
echo Formatter::fileSize($table->getAverageRowSize());
?>
</td>
</tr>
<?php
if ($table->AUTO_INCREMENT) {
?>
<tr>
<td><?php
echo Yii::t('core', 'nextAutoincrementValue');
?>
</td>
<td><?php
echo $table->AUTO_INCREMENT;
?>
</td>