file_exists (PHP 3, PHP 4 ) file_exists -- Prüft, ob eine Datei oder ein Verzeichnis existiert Beschreibungbool file_exists ( string filename)
Gibt TRUE zurück, wenn die mit filename
spezifizierte Datei bzw. das Verzeichnis existiert, andernfalls FALSE.
Zum Prüfen von Dateien auf Windows network shares verwenden Sie bitte
//computername/share/filename oder
\computername\share\filename.
Beispiel 1. Testen, ob eine Datei existiert
<?php $filename = '/path/to/foo.txt';
if (file_exists($filename)) { print "The file $filename exists"; } else { print "The file $filename does not exist"; } ?>
|
|
Anmerkung: The results of this
function are cached. See clearstatcache() for
more details.
Anmerkung: This function will not work on
remote files as the file to
be examined must be accessible via the servers filesystem.
Siehe auch is_readable(), is_writable(),
is_file() und file().
|