Files
pull-courseware/app/common.php
2025-04-18 00:39:21 +08:00

17 lines
437 B
PHP

<?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;
}
}