- Home
- Categorie
- Coding e Sistemistica
- PHP
- [File e Cartelle] file_exists();
-
[File e Cartelle] file_exists();
PHP 4, 5
Sintassi: bool file_exists ( string $file )file_exists è una funzione di PHP che verifica l'esistenza del file passato come argomento.
[php]<?
$file = "../dir/file.txt";
if (file_exists($file))
{
echo "Il file $file esiste";
}
else
{
echo "Il file $file non esiste";
}
?>[/php]
La funzione restituirà TRUE in caso affermativo (il file esiste) oppure FALSE in caso contrario.