首页 > php文件操作 > php检查文件是否可读和可写

php检查文件是否可读和可写

is_readable() 函数判断指定文件名是否可读。

<?php
$file = "test.txt";
if (is_readable($file)) {
    echo ("$file is readable");
} else {
    echo ("$file is not readable");
}
?>

is_writeable() 函数判断指定的文件是否可写。

该函数是 is_writable() 函数的别名。

<?php
$file = "test.txt";
if (is_writeable($file)) {
    echo ("$file is writeable");
} else {
    echo ("$file is not writeable");
}
?>

               
               

本文地址:http://www.phprm.com/wenjian/fs152.html

转载随意,但请附上文章地址:-)

标签:php文件读写 php检查文件

相关文章

发表留言