说明
bool
is_readable ( string filename )
如果由 filename
指定的文件或目录存在并且可读则返回 TRUE。
记住 PHP 也许只能以运行 webserver 的用户名(通常为
'nobody')来访问文件。不计入安全模式的限制。
例 1. is_readable() 例子 <?php
$filename = 'test.txt';
if (is_readable($filename)) {
echo 'The file is readable';
} else {
echo 'The file is not readable';
}
?> |
|
提示: 自 PHP 5.0.0
起本函数也可被某些 URL wrapper 使用。参考附录 O 来看哪些 wrapper 支持
stat() 系列函数的功能。
参见 is_writable(),file_exists()
和 fgets()。