PHP is_readable() 函數(shù)
定義和用法
is_readable() 函數(shù)判斷指定文件名是否可讀。
語(yǔ)法
is_readable(file)
| 參數(shù) | 描述 |
|---|---|
| file | 必需。規(guī)定要檢查的文件。 |
說(shuō)明
如果由 file 指定的文件或目錄存在并且可讀,則返回 TRUE。
提示和注釋
注釋?zhuān)?/span>本函數(shù)的結(jié)果會(huì)被緩存。請(qǐng)使用 clearstatcache() 來(lái)清除緩存。
例子
<?php
$file = "test.txt";
if(is_readable($file))
{
echo ("$file is readable");
}
else
{
echo ("$file is not readable");
}
?>
輸出:
test.txt is readable