PHP is_file() Functie
❮ Referentie voor PHP-bestandssysteemVoorbeeld
Controleer of de opgegeven bestandsnaam een gewoon bestand is:
<?php
$file = "test.txt";
if(is_file($file)) {
echo ("$file is a regular file");
} else {
echo ("$file is not a regular file");
}
?>
De uitvoer van de bovenstaande code zou kunnen zijn:
test.txt is a regular file
Definitie en gebruik
De functie is_file() controleert of de opgegeven bestandsnaam een normaal bestand is.
Opmerking: het resultaat van deze functie wordt in de cache opgeslagen. Gebruik clearstatcache() om de cache te wissen.
Syntaxis
is_file(file)
Parameterwaarden
Parameter | Description |
---|---|
file | Required. Specifies the path to the file to check |
Technische details
Winstwaarde: | TRUE als het bestand een normaal bestand is, anders FALSE |
---|---|
PHP-versie: | 4.0+ |
❮ Referentie voor PHP-bestandssysteem