PHP头条
热点:

byte(字节)转换为mb(兆)-PHP源码


1. [代码][PHP]代码

function formatBytes($bytes) {
	if($bytes >= 1073741824) {
		$bytes = round($bytes / 1073741824 * 100) / 100 . 'GB';
	} elseif($bytes >= 1048576) {
		$bytes = round($bytes / 1048576 * 100) / 100 . 'MB';
	} elseif($bytes >= 1024) {
		$bytes = round($bytes / 1024 * 100) / 100 . 'KB';
	} else {
		$bytes = $bytes . 'Bytes';
	}
	return $bytes;
}

www.phpzy.comtrue/php/36658.htmlTechArticlebyte(字节)转换为mb(兆)-PHP源码 1. [代码] [PHP]代码 function formatBytes($bytes) {if($bytes >= 1073741824) {$bytes = round($bytes / 1073741824 * 100) / 100 . GB;} elseif($bytes >= 1048576) {$bytes = round($bytes / 1048576 * 1...

相关文章

PHP之友评论

今天推荐