Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> fopen
GrayHat
post
Post #1





Grupa: Zarejestrowani
Postów: 566
Pomógł: 18
Dołączył: 23.08.2003
Skąd: Łomża

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


siema. napisalem taki kodzik i mam pyt czy macie lepszy pomysl na rozwiazanie tego problemu. problem jest taki, ze chce sprawdzic czy plik istnieje ale na innym servie... moj kod:

[php:1:1d41da408e]<?php
if (@fopen($vars->file_url),"r")){
//plik istnieje
} else {
//plik nie istnieje
}
?>[/php:1:1d41da408e]
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
FiDO
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 717
Pomógł: 0
Dołączył: 12.06.2002
Skąd: Wolsztyn..... Studia: Zielona Góra

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


Cytat
If you are trying to check whether a remote file (or url) exists, you can open it and close it in the same statement.  

[php:1:d84fd24dbe]<?php  

if (@fclose(@fopen("http://www.example.com", "r"))) {  
    print("File exists.");  
} else {  
    print("File does not exist.");  
}
?>[/php:1:d84fd24dbe]
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 - 14:13