is_writeable() 関数は、指定したファイルが出力可能かどうかをチェックします。
この関数は、ファイルが出力可能な場合は TRUE を返します。
この関数は、is_writable() 関数のエイリアスです。
is_writeable(file)
パラメータ | 説明 |
---|---|
file | 必須。チェックするファイルを指定する |
注: この関数の結果はキャッシュされます。キャッシュをクリアするには clearstatcache()を使用します。
<?php
$file = "test.txt";
if(is_writeable($file))
{
echo ("$file is writeable");
}
else
{
echo ("$file is not writeable");
}
?>
上のコードの出力は次の様になります:
test.txt is writeable