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

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

PHP中文网
PHP中文网Original
2016-05-25 17:13:201180browse

         

=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*/

                                   

Statement:
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
Previous article:Zebra_Image 示例代码Next article:PHP无刷新上传文件