1
0

first commit

This commit is contained in:
2020-08-06 14:58:51 +08:00
commit 17096657dc
780 changed files with 92857 additions and 0 deletions

26
extend/tools/Format.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace tools;
class Format
{
/**
* 格式化字节数显示
* @param integer $value
* @return string
*/
public static function byte($value)
{
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
for ($i = 0; $value >= 1024 && $i < 5; $i++) {
$value /= 1024;
}
return round($value, 2) . $units[$i];
}
}