קריאת קבצים DIR
אני מנסה לקרוא רקורסיבית מ PATH מסויים את כל הקבצים תחתיו עם ה PATH המלא שלהם. הבעיה היא שכאשר הפונקציה קוראת לעצמה היא לא חוזרת בסוף הקריאה לאותו מקום בו היא קראה לעצמה ... <DIV> <html> <body> <?php $folder_path=´C:/phpdev/www´; file_system($folder_path); function file_system($folder_path) { echo "<BR>".$folder_path."<BR>"; chdir($folder_path); echo "<BR><font color=green> ".$folder_path."</font><BR>"; $handle=opendir($folder_path); while ($file = readdir($handle)) { $files[]=$file; } foreach ($files as $file){ if ($file != "." && $file != "..") { if (!is_dir($file)) { echo "<b> file</b> ".$folder_path.´/´.$file."<BR>"; } } } echo $folder_path; $handle=opendir($folder_path); while ($file = readdir($handle)) { $files[]=$file; } foreach ($files as $file){ if ($file != "." && $file != "..") { if (is_dir($file)) { echo "<font color=blue>Dir $folder_path/$file </font><BR>" ; $temp=$folder_path.´/´.$file; file_system($temp); } } } }; ?> </body> </html> </DIV>
אני מנסה לקרוא רקורסיבית מ PATH מסויים את כל הקבצים תחתיו עם ה PATH המלא שלהם. הבעיה היא שכאשר הפונקציה קוראת לעצמה היא לא חוזרת בסוף הקריאה לאותו מקום בו היא קראה לעצמה ... <DIV> <html> <body> <?php $folder_path=´C:/phpdev/www´; file_system($folder_path); function file_system($folder_path) { echo "<BR>".$folder_path."<BR>"; chdir($folder_path); echo "<BR><font color=green> ".$folder_path."</font><BR>"; $handle=opendir($folder_path); while ($file = readdir($handle)) { $files[]=$file; } foreach ($files as $file){ if ($file != "." && $file != "..") { if (!is_dir($file)) { echo "<b> file</b> ".$folder_path.´/´.$file."<BR>"; } } } echo $folder_path; $handle=opendir($folder_path); while ($file = readdir($handle)) { $files[]=$file; } foreach ($files as $file){ if ($file != "." && $file != "..") { if (is_dir($file)) { echo "<font color=blue>Dir $folder_path/$file </font><BR>" ; $temp=$folder_path.´/´.$file; file_system($temp); } } } }; ?> </body> </html> </DIV>