ファイルのパーミッションを確認
読み取り権限(R)の確認:
<?php
$file = 'example.txt';
if (is_readable($file)) {
echo "The file '$file' is readable.";
} else {
echo "The file '$file' is not readable.";
}
?>
書き込み権限(W)の確認:
<?php
$file = 'example.txt';
if (is_writable($file)) {
echo "The file '$file' is writable.";
} else {
echo "The file '$file' is not writable.";
}
?>
実行権限(X)の確認:
<?php
$file = 'example.txt';
if (is_executable($file)) {
echo "The file '$file' is executable.";
} else {
echo "The file '$file' is not executable.";
}
?>