PHP 中的 is_writeable() 函数
phpprogrammingserver side programming更新于 2025/7/9 12:52:17
is_writeable() 函数检查文件是否可写。如果文件存在且可写,则返回 TRUE。
is_writeablle() 函数是 is_writable() 的别名。使用 is_writeable() 代替 is_writable() 的一个好处是,is_writable() 函数在源代码中搜索包含单词"table"的文件时会影响搜索结果。
语法
is_writeable(file_path)
参数
file_path − 待检查文件的路径。
返回
如果文件存在且可写,is_writeable() 函数返回 TRUE。
示例
<?php
$file = "demo.txt";
if(is_writeable($file)) {
echo ("File is writeable!");
} else {
echo ("File is not writeable!");
}
?>
输出
File is not writeable!

