Latest web development tutorials

PHP is_readable () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

is_readable () function checks whether the specified file readable.

If the file is readable, the function returns TRUE.

grammar

is_readable(file)

参数 描述
file 必需。规定要检查的文件。


Tips and Notes

Note: The results of this function are cached.Use clearstatcache () to clear the cache.


Examples

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

The code above will output:

test.txt is readable


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual