PHP中kb转mb,gb

public function switchSize($filesize) {
   if($filesize >= 1048576) {
      $filesize = round($filesize / 1048576 * 100) / 100 . 'GB';
   } elseif($filesize >= 1024) {
      $filesize = round($filesize / 1024 * 100) / 100 . 'MB';
   } else {
      $filesize = $filesize . 'KB';
   }
   return $filesize;
}

原文链接:https://www.codelovers.cn/article/20180820170942.html

猜你喜欢

转载自blog.csdn.net/tangjuntangjun/article/details/82047985