Home > php教程 > PHP源码 > 有意思的一个操作实例(需要在linux环境下跑)-PHP

有意思的一个操作实例(需要在linux环境下跑)-PHP

PHP中文网
Release: 2016-05-25 17:13:20
Original
1178 people have browsed it

         

=0  AND $unit/1024 1024 AND $unit/1024 <= 1024*1024 ) {
			$unit = &#39;M&#39;;
		} else {
			$unit = &#39;G&#39;;
		}
	}
	switch(strtolower($unit)) {
		case &#39;k&#39;:
			$size = ($size/1024);
			$suffix = &#39;KB&#39;;
			break;
		case &#39;m&#39;:
			$size = ($size/1024/1024);
			$suffix = &#39;MB&#39;;
			break;
		case &#39;g&#39;:
			$size = ($size/1024/1024/1024);
			$suffix = &#39;GB&#39;;
			break;
	}
	$size = sprintf("%.2f%s", $size, $suffix);
	return $size;
}

$path = &#39;min&#39;;
var_dump(_dirSize($path, FALSE));
var_dump(_dirSize($path, TRUE));
var_dump(_getDirCount($path));

/*end of php*/
Copy after login

                                   

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template