Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> is_dir
ceo
post
Post #1





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: --

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


mam taki kod :

  1. <?php
  2.  
  3. $default_dir = $_GET['co']; 
  4. echo&#092;"<b>$default_dir</b><br><br>\";
  5. if(!($dp = opendir($default_dir))) die(&#092;"Nie mogę otworzyć $default_dir.\"); 
  6. while($file = readdir($dp))
  7.  if($file != '.' && $file != '..' ) {
  8.  echo &#092;"$nbsp;<a href=\"$default_dir/$file\">$file</a><br>\"; 
  9.  }
  10. closedir($dp); 
  11.  
  12.  
  13. ?>


jak zrobic by petla wyswietlala tylko pliki a nie podkatalogi i pliki w $default_dir
?
probowalem przez is_dir ale zwraca mi caly czas wartosc true jak robie

$typ=is_dir($file);
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
czachor
post
Post #2





Grupa: Zarejestrowani
Postów: 897
Pomógł: 40
Dołączył: 16.12.2003
Skąd: Warszawa

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


  1. <?php
  2. if($file != '.' && $file != '..' && !is_dir($file))
  3. ?>
Go to the top of the page
+Quote Post
Darti
post
Post #3





Grupa: Zarejestrowani
Postów: 1 076
Pomógł: 62
Dołączył: 6.03.2005
Skąd: Wroc

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


a tak?
  1. <?php
  2. $default_dir = $_GET['co']; 
  3. echo&#092;"<b>$default_dir</b><br><br>\";
  4. if(!($dp = opendir($default_dir))) die(&#092;"Nie mogę otworzyć $default_dir.\"); 
  5. while($file = readdir($dp))
  6.  if($file != '.' && $file != '..' && !is_dir($file)) {
  7.  echo &#092;"$nbsp;<a href=\"$default_dir/$file\">$file</a><br>\"; 
  8.  }
  9. closedir($dp);
  10. ?>


Ten post edytował Darti 14.03.2005, 21:12:23
Go to the top of the page
+Quote Post
ceo
post
Post #4





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: --

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


poradzilem sobie

  1. <?php
  2.  if($file != '.' && $file != '..' && !is_dir($default_dir.'/'.$file)) {
  3. ?>


Ten post edytował ceo 14.03.2005, 21:16:39
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: 22.08.2025 - 17:29