PHP file_exists() functie

Definitie en gebruik

De file_exists() functie controleert of een bestand of directory bestaat.

Retourneert true als het opgegeven bestand of directory bestaat, anders retourneert het false.

Syntax

file_exists(pad)
Parameter Beschrijving
pad Verplicht. Stelt het pad in dat moet worden gecontroleerd.

Voorbeeld

<?php
echo file_exists("test.txt");
?>

Uitvoer:

1