Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]usuwanie katalogu wraz z plikami, nieaktualne - juz mniej wiecej działa
glasswalker
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 21.11.2008

Ostrzeżenie: (0%)
-----


Już po poprawieniu - czyli na razie działa jak powinien.
CODE
  1. <?php
  2. function delDir($dir)
  3. {
  4. if(!$fd=opendir($dir))
  5. {
  6. return false;
  7. }
  8. else
  9. {
  10. while(($file=readdir($fd))!==false)
  11. {
  12. if($file=="."||$file=="..") continue;
  13. if((is_dir("$dir/$file")))
  14. {
  15. delDir("$dir/$file");
  16. rmdir("$dir/$file");
  17. }
  18. else if(is_file("$dir/$file"))
  19. {
  20. unlink("$dir/$file");
  21. }
  22. }
  23. closedir($fd);
  24. }
  25. }
  26. delDir("ppp1");
  27. ?>


Ten post edytował glasswalker 11.09.2009, 13:03:01
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
vokiel
post
Post #2





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

Ostrzeżenie: (0%)
-----


Pomyśl co się dzieje w tym fragmencie kodu?
  1. if(is_dir("$dir/$file"))
  2. {
  3. delDir("$dir/$file");
  4. rmdir("$dir/$file");
  5. }
Czy kiedykolwiek funkcja dochodzi do rmdir ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 5.10.2025 - 23:48