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