<?php
/
filesize 得到文件大小,返因单位为字节
unlink 删除文件
/
/echo "<pre>";
print_r(get_declared_classes());/
while(($file = $dir->read())!==FALSE){
echo $file."
";
}
$dir->close();
$dir->rewind();
echo "
";
while(($file = $dir->read())!==FALSE){
echo $file."
";
}*/
//echo filesize('60/a.txt')/1024;
/sleep(6);
unlink('60/1.php');/
/sleep(5);
array_map(unlink, glob('60*.'));*/
/function dirSize($dirname) {
$dir = opendir ( $dirname );
while ( ($file = readdir ( $dir )) !== FALSE ) {
$filename = $dirname . '\' . $file;
if ($file != '.' && $file != '..') {
if (is_dir ( $file )) {
$count += dirSize ( $file );
} else {
$count += filesize ( $filename );
}
}
}
return $count;
}
echo dirSize ( '.' ) / pow(1024,2);/
/function dirSize_glob($dirname){
$dirInfo = glob("{$dirname}*");
foreach ($dirInfo as $v){
if(is_dir($v)){
$count +=dirSize_glob($v);
}else{
$count +=filesize($v);
}
}
return $count;
}
echo dirSize_glob('.')/pow(1024,2);/
/function dirSize_scandir($dirname){
$dirArr = scandir($dirname);
foreach ($dirArr as $v){
$fileName = $dirname.'\'.$v;
if($v!='.' && $v!='..'){
if(is_dir($fileName)){
$count +=dirSize_scandir($fileName);
}else{
$count+=filesize($fileName);
}
}
}
return $count;
}
echo dirSize_scandir('.')/pow(1024,2);/
共同学习,写下你的评论
评论加载中...
作者其他优质文章