Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Wyświetlanie plików w katalogu
david8213
post
Post #1





Grupa: Zarejestrowani
Postów: 308
Pomógł: 0
Dołączył: 9.12.2009

Ostrzeżenie: (10%)
X----


Co należy wstawić w miejsce kropek żeby po kliknięciu na dany plik otworzył się. (Odnośnik do niego)

Kod
      <?php
  
      $dirArray = array();
  
      $opdir = opendir(".");
  
      while($file = readdir($opdir)){
  
      if ($file === '.' || $file === '.' || $file === '..') continue;
  
      $dirArray[] = $file;
  
      }
  
      closedir($opdir);
          
  
      sort($dirArray);
  
      echo implode("<br><a href=\"..................\">",$dirArray);

      ?>


Ten post edytował david8213 10.02.2010, 16:16:31
Go to the top of the page
+Quote Post
neverever
post
Post #2





Grupa: Zarejestrowani
Postów: 278
Pomógł: 44
Dołączył: 17.02.2004
Skąd: Wieliczka

Ostrzeżenie: (10%)
X----


zamiast
  1. echo implode("<br><a href=\"..................\">",$dirArray);

daj

  1. foreach($dirArray as $file){
  2. echo '<a href="'.$file.'">'.$file.'</a><br />';
  3. }
Go to the top of the page
+Quote Post
david8213
post
Post #3





Grupa: Zarejestrowani
Postów: 308
Pomógł: 0
Dołączył: 9.12.2009

Ostrzeżenie: (10%)
X----


Chciałem dołożyć rozmiar plików

Zrobiłem to tak:

Kod
['.filesize($file).']


ale czy można wyświetlić to nie w bajtach tylko w kilobajtach lub MB ?

Ten post edytował david8213 11.02.2010, 23:12:28
Go to the top of the page
+Quote Post
erix
post
Post #4





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Można: http://pl.wikipedia.org/wiki/Bajt
Go to the top of the page
+Quote Post

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: 1.01.2026 - 09:46