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 リファレンスマニュアル その他の拡張モジュール