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