PHP is_writable () function
Definition and Usage
is_writable () function checks whether the specified file is writable.
If the file can be written, the function returns TRUE.
grammar
is_writable(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的文件。 |
Tips and Notes
Note: The results of this function are cached.Use clearstatcache () to clear the cache.
Examples
<?php
$file = "test.txt";
if(is_writable($file))
{
echo ("$file is writeable");
}
else
{
echo ("$file is not writeable");
}
?>
$file = "test.txt";
if(is_writable($file))
{
echo ("$file is writeable");
}
else
{
echo ("$file is not writeable");
}
?>
The code above will output:
test.txt is writeable
Complete PHP Filesystem Reference Manual