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