PHP is_readable() 函數


PHP Filesystem 參考手冊 完整的 PHP Filesystem 參考手冊

定義和用法

is_readable() 函數檢查指定的檔是否可讀。

如果檔可讀,該函數返回 TRUE。

語法

is_readable(file)

參數 描述
file 必需。規定要檢查的檔。


提示和注釋

注釋:該函數的結果會被緩存。請使用 clearstatcache() 來清除緩存。


實例

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

上面的代碼將輸出:

test.txt is readable


PHP Filesystem 參考手冊 完整的 PHP Filesystem 參考手冊