Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wynik
stefan_precz
post
Post #1





Grupa: Zarejestrowani
Postów: 134
Pomógł: 0
Dołączył: 2.01.2005

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


  1. <?php
  2. if ($handle = opendir('test/')) {
  3.  
  4.  
  5.  while (false !== ($file = readdir($handle))) {
  6.  echo &#092;"$file<br />\";
  7.  }
  8.  closedir($handle);
  9. }
  10. ?>
ten kody wczytuje pliki z katalogu

jak zrobić aby zczytywało mi tylko pliki zaczynające się na TN_
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Nie jestem pewien czy dobrze zrozumialem. Chcesz z plików które wybierasz usunąć początek TN_?Dorabiam więc substr($file,3)
  1. <?php
  2.  
  3. if ($handle = opendir(&#092;"$dir\")) {
  4.  
  5.  while (false !== ($file = readdir($handle))) {
  6.  
  7.  if(preg_match(&#092;"/^TN_/\", $file)) echo \"<a href=\"foto.php?id=$co&show=\".$file.\"\" target=\"_blank\"><img src=\"$dir/\".substr($file,3).\"\" /></a>&nbsp;\";
  8.  }
  9.  closedir($handle);
  10. }
  11.  
  12. ?>
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 - 19:17