Group: Administrator Level: heavy Spammer
Posts: 3610 Joined: 3/11/2004 IP-Address: saved
| Mit diesem PHP-Code könnt ihr Dateien und Verzeichnisse auflisten:
<?php function is_dir_ex($dirname) { $handle=opendir($dirname); if(readdir($handle)=='.') $result=true; else $result=false; closedir($handle); return $result; } function list_dir($dirname) { if($dirname[strlen($dirname)-1]!='\') $dirname.='\'; static $result_array=array(); $handle=opendir($dirname); while ($file = readdir($handle)) { if($file=='.'||$file=='..') continue; if(is_dir_ex($dirname.$file)) list_dir($dirname.$file.'\'); else //array_push($result_array,$dirname.$file); $result_array[]=$dirname.$file; } closedir($handle); return $result_array; }
$array=list_dir('c:\php4'); foreach($array as $value) { echo $value; echo "<br>"; } ?>
|