is_readable()函数可以检查指定的文件是否可读。如果文件可读,则此函数返回true。
bool is_readable ( string $filename )
此函数可以判断文件是否存在并且可读。
<?php
$file = "/PhpProject/php/phptest.txt";
if(is_readable($file)) {
echo ("$file is readable");
} else {
echo ("$file is not readable");
}
?>
输出结果
/PhpProject/php/phptest.txt is readable