<?php
function is_empty_dir($fp)
{
$H = @opendir($fp);
$i=0;
while($_file=readdir($H)){
$i++;
}
closedir($H);
if($i>2){
return 1;
}else{
return 2;
}
}
$pash = "uploadfile/lampshow_1000";
list_file($pash);
function list_file($pash){
$temp=scandir($pash,SCANDIR_SORT_NONE);
foreach($temp as $v){
$a=$pash.'/'.$v;
if(is_dir($a)){
if($v=='.' || $v=='..'){
continue;
}
$is_empty = is_empty_dir($a);
if($is_empty == 2 ){
echo "空的";
}
list_file($a);
}else{
$end = explode(".", $a);
$type = strtolower(end($end));
echo $type;
if($type == "jpg"){
chmod($a, 0777);
$txt1 = file_get_contents($a);
}
}
}
}
|