is_readable()函數(shù)可以檢查指定的文件是否可讀。如果文件可讀,則此函數(shù)返回true。
bool is_readable ( string $filename )
此函數(shù)可以判斷文件是否存在并且可讀。
<?php
$file = "/PhpProject/php/phptest.txt";
if(is_readable($file)) {
echo ("$file is readable");
} else {
echo ("$file is not readable");
}
?>輸出結(jié)果
/PhpProject/php/phptest.txt is readable