初始化
This commit is contained in:
17
app/common.php
Normal file
17
app/common.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
// 应用公共文件
|
||||
function store_path(string $disk = 'local')
|
||||
{
|
||||
return config('filesystem.disks.'.$disk.'.root');
|
||||
}
|
||||
function bytesToSize($a,int $decimals = 2){
|
||||
$d = [" B", " KB", " MB", " GB", " TB", " PB"];
|
||||
$e = 1024;
|
||||
for ($b = 0; $b < count($d); $b++) {
|
||||
if ($a < $e) {
|
||||
$ret = $b == 0 ? $a : number_format($a,$decimals);
|
||||
return $ret . $d[$b];
|
||||
}
|
||||
$a /= $e;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user