zoukankan      html  css  js  c++  java
  • php 文件大小计算转换

      /**
         * [tosize description]
         * @Author:XuXianGang
         * @Method: 文件格式大小
         * @DateTime:2021-09-02T15:44:07+0800
         * @param[type] $file_size [文件大小]
         * @return[type]            [description]
         */
        function tosize($file_size){
            $file_size = $file_size-1;
            if ($file_size >= 1099511627776) 
                $show_filesize = number_format(($file_size / 1099511627776),2) . " TB";
            elseif ($file_size >= 1073741824) 
                $show_filesize = number_format(($file_size / 1073741824),2) . " GB";
            elseif ($file_size >= 1048576) 
                $show_filesize = number_format(($file_size / 1048576),2) . " MB";
            elseif ($file_size >= 1024) 
                $show_filesize = number_format(($file_size / 1024),2) . " KB";
            elseif ($file_size > 0) 
                $show_filesize = $file_size . " b";
            elseif ($file_size == 0 || $file_size == -1) 
                $show_filesize = "0 b";
            return $show_filesize;
        }
      
  • 相关阅读:
    事件委托
    a标签深入研究
    windows查看端口号
    什么是WCM
    map key循环
    用Myeclipse打war包
    myeclipse 8.510.0 安装 svn 方法
    SVN使用&CVS使用
    MyEclipse 字体大小 字体颜色
    什么是Quickr
  • 原文地址:https://www.cnblogs.com/xiangangXu1997/p/15531858.html
Copyright © 2011-2022 走看看