(PHP 4, PHP 5)
如果文件存在并且可写则返回 TRUE。filename 参数可以是一个允许进行是否可写检查的目录名。
记住 PHP 也许只能以运行 webserver 的用户名(通常为 'nobody')来访问文件。不计入安全模式的限制。
例子 1. is_writable() 例子
<?php$filename = 'test.txt';if (is_writable($filename)) { echo 'The file is writable';} else { echo 'The file is not writable';}?>
注: 本函数的结果会被缓存。更多信息参见 clearstatcache()。
提示: 自 PHP 5.0.0 起本函数也可被某些 URL wrapper 使用。参考附录 L 来看哪些 wrapper 支持 stat() 系列函数的功能。
See also is_readable(), file_exists(), and fwrite().