- function formatSizeUnits($bytes)
- {
- if($bytes >= 1073741824){
- $bytes = number_format($bytes / 1073741824, 2) . ' GB';
- } elseif($bytes >= 1048576){
- $bytes = number_format($bytes / 1048576, 2) . ' MB';
- } elseif ($bytes >= 1024){
- $bytes = number_format($bytes / 1024, 2) . ' KB';
- } elseif ($bytes > 1){
- $bytes = $bytes . ' bytes';
- } elseif ($bytes == 1){
- $bytes = $bytes . ' byte';
- } else {
- $bytes = '-';
- }
- return $bytes;
- }//Close Functions.
ตัวอย่าง
https://intranet.sci.com/sci/CheckServer/check_start.php
https://stackoverflow.com/questions/5501427/php-filesize-mb-kb-conversion/5501447
ไม่มีความคิดเห็น:
แสดงความคิดเห็น