PHP chmod()関数
❮PHPファイルシステムリファレンス例
「test.txt」ファイルの権限を変更します。
<?php
// Read and write for owner, nothing for everybody else
chmod("test.txt",0600);
// Read and write for owner, read for everybody else
chmod("test.txt",0644);
// Everything for owner, read and execute for everybody else
chmod("test.txt",0755);
// Everything for owner, read for owner's group
chmod("test.txt",0740);
?>
定義と使用法
chmod()関数は、指定されたファイルのパーミッションを変更します。
構文
chmod(file, mode)
パラメータ値
Parameter | Description |
---|---|
file | Required. Specifies the path to the file |
mode | Required. Specifies the new permissions. The mode parameter consists of four numbers:
Possible values (to set multiple permissions, add up the following numbers):
|
技術的な詳細
戻り値: | 成功した場合はTRUE、失敗した場合はFALSE |
---|---|
PHPバージョン: | 4.0以降 |
❮PHPファイルシステムリファレンス