Latest web development tutorials

PHP is_writeable () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

is_writeable () function checks whether the specified file is writable.

If the file can be written, the function returns TRUE.

This function is an alias is_writable () function.

grammar

is_writeable(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_writeable($file))
{
echo ("$file is writeable");
}
else
{
echo ("$file is not writeable");
}
?>

The code above will output:

test.txt is writeable


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual