English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The is_writable() function can check if the specified file is writable. If the file is writable, this function can return true.
bool is_writable ( string $filename )
If the filename exists and is writable, this function can return true. The filename parameter can be a directory name, which allows us to also check if the directory is writable.
<?php $file = "/PhpProject/php/phptest.txt"; if(is_writable($file)) { echo ("$file is writable"); } else { echo ("$file is not writable"); } ?>
Output result
/PhpProject/php/phptest.txt is writablePHP Filesystem 参考手册