myglob(getcwd()."/*");
function mydir($dir){
$d = dir($dir);
while(($file = $d->read()) !== false){
if($file != "." && $file != ".."){
if(is_dir($dir.DIRECTORY_SEPARATOR.$file)){
echo "目录:".$dir.DIRECTORY_SEPARATOR.$file."<br/>";
mydir($dir.DIRECTORY_SEPARATOR.$file);
} else {
echo "文件:".$dir.DIRECTORY_SEPARATOR.$file."<br/>";
}
}
}
$d->close();
}
function myreaddir($dir){
$hander = opendir($dir);
// var_dump($hander);exit;
if($hander){
while(($file = readdir($hander)) != false){
if($file != "." && $file != ".."){
if(is_dir($dir.DIRECTORY_SEPARATOR.$file)){
echo "目录:".$dir.DIRECTORY_SEPARATOR.$file."<br/>";
myreaddir($dir.DIRECTORY_SEPARATOR.$file.DIRECTORY_SEPARATOR);
} else {
echo "文件:".$dir.$file."<br/>";
}
}
}
}
closedir($hander);
}
function myglob($dir){
// print_r(g);exit;
foreach(glob($dir) as $file){
if($file != "." && $file != ".."){
// echo $file."<br/>";
if(is_dir($file)){
echo "目录:".$file."<br/>";
myglob($file."/*");
} else {
echo "文件:".$file."<br/>";
}
}
}
}