Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [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
 
Start new topic
Odpowiedzi
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

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: 26.12.2025 - 23:06