PHP expert |
|
PHP.net:
aryel at redtwilight dot com dot br schreef: 07-Feb-2007 08:07
This function is similar to scandir, but works in PHP4. It uses readdir to get directory info.
<?php
if(!function_exists('scandir'))
{
function scandir($dir,$listDirectories=false, $skipDots=true) {
$dirArray = array();
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (($file != "." && $file != "..") || $skipDots == true) {
if($listDirectories == false) { if(is_dir($file)) { continue; } }
array_push($dirArray,basename($file));
}
}
closedir($handle);
}
return $dirArray;
}
}
?>
<?php { function scandir($dir,$listDirectories=false, $skipDots=true) { while (false !== ($file = readdir($handle))) { if (($file != "." && $file != "..") || $skipDots == true) { if($listDirectories == false) { if(is_dir($file)) { continue; } } } } } return $dirArray; } } ?>
Probeer dit eens?
Plak dat even bovenaan de pagina |