English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Filesystem Referência Manual
A função file_exists() pode verificar se um arquivo ou diretório existe. Se o arquivo ou diretório existir, esta função retorna true, caso contrário, retorna false.
bool file_exists ( string $filename )
Esta função pode verificar se um arquivo ou diretório existe.
<?php $filename = "/PhpProject/sample.txt" if(file_exists($filename)) { echo "Arquivo $filename existe"; } else { echo "Arquivo $filename não existe"; } ?>
Resultado de saída
Arquivo /PhpProject/sample.txt existe