Klasörleri ve alt klasörleri içeren bir listeyi almaya çalışıyorum, klasörleri ve alt klasörleri almamı sağlayan aşağıdakilere sahibim. Örneğin aşağıda çalışıyordum ama nasıl etrafta dolaşacağımı bilmiyorum. PHP'de klasörleri ve alt klasörleri nasıl görüntüleyeceğiniz
Root/
Root/Images
Root/Images/UserImages
Root/Text/
Root/Text/User1/
Root/Text/User1/Folder2
ama monent
buRoot/css/
tree/css/
js/
images/
PHP KODU gibi onun ekran:
function ListFolder($path)
{
$dir_handle = @opendir($path) or die("Unable to open $path");
//Leave only the lastest folder name
$dirname = end(explode("/", $path));
//display the target folder.
echo ("$dirname/");
while (false !== ($file = readdir($dir_handle)))
{
if($file!="." && $file!="..")
{
if (is_dir($path."/".$file))
{
//Display a list of sub folders.
ListFolder($path."/".$file);
echo "<br>";
}
}
}
//closing the directory
closedir($dir_handle);
}
ListFolder("../");
Bir dizide dizin adları toplayın yerine echo
size
olası yinelenen ayarlayacaktır: //stackoverflow.com/questions/2418068/php-spl-recursivedirectoryiterator-recursiveiteratoriterator-retrieving-the-full) – Gordon