Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] problem z file_get_contents
terreska
post
Post #1





Grupa: Zarejestrowani
Postów: 80
Pomógł: 0
Dołączył: 23.07.2006

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


Mam skrypcik, który używa file_get_contents.
Skrypt sprawdza po kolei kilkanaście plików.
Niestety gdy nie znajdzie pliku wyświetla false i zatrzymuje wykonywanie skryptu.
Da się to jakoś ominąć?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
fridek
post
Post #2





Grupa: Zarejestrowani
Postów: 61
Pomógł: 0
Dołączył: 19.12.2006

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


może:
  1. <?php
  2. if(is_file($filename)) file_get_contents($filename);
  3. ?>

?
Go to the top of the page
+Quote Post
devnul
post
Post #3





Grupa: Zarejestrowani
Postów: 1 470
Pomógł: 75
Dołączył: 21.09.2005
Skąd: że znowu

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


imho powinno być
  1. <?php
  2. if(file_exists($filename) && is_file($filename)) {
  3. file_get_contents($filename);
  4. }
  5. ?>
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: 19.09.2025 - 15:28