Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] liczenie plików
-fajnykamil-
post 5.02.2008, 15:44:48
Post #1





Goście







jak zrobic zeby PHP liczylo pliki w folderze i zapisywalo ich liczbe do zmiennej
Go to the top of the page
+Quote Post
mike
post 5.02.2008, 16:05:06
Post #2





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


glob() + count()
Go to the top of the page
+Quote Post
potreb
post 5.02.2008, 16:08:32
Post #3





Grupa: Zarejestrowani
Postów: 1 568
Pomógł: 192
Dołączył: 7.03.2005
Skąd: Warszawa

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


  1. <?php
  2. function countFiles($strDirName)
  3. {
  4. if ($hndDir = opendir($strDirName))
  5. {
  6. $intCount = 0;
  7. while (false !== ($strFilename = readdir($hndDir)))
  8. {
  9. if ($strFilename != "." && $strFilename != "..")
  10. {
  11. $intCount++;
  12. }
  13. }
  14. closedir($hndDir);
  15. }
  16. else
  17. {
  18. $intCount = -1;
  19. }
  20.  
  21. return $intCount;
  22. }
  23.  
  24. echo countFiles("C:Temp");
  25. ?>


--------------------

Go to the top of the page
+Quote Post
specialplan
post 6.02.2008, 00:50:32
Post #4





Grupa: Zarejestrowani
Postów: 206
Pomógł: 21
Dołączył: 1.09.2006
Skąd: Edinburgh

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


DirectoryIterator - poczytaj w manualu. Pzdr.
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 12.06.2025 - 13:28