Php-function-chmod
提供:Dev Guides
PHP-関数chmod()
構文
bool chmod ( string $filename, int $mode );
定義と使い方
指定されたファイルのモードをmodeで指定されたモードに変更しようとします。
パラメーター
Sr.No | Parameter & Description |
---|---|
1 |
path ファイルパス。 |
2 |
mode modeは自動的に8進数値と見なされないため、文字列(「g + w」など)は正しく機能しません。 期待される動作を確保するには、モードの前にゼロ(0)を付ける必要があります- |
戻り値
成功した場合にTRUE、失敗した場合にFALSEを返します。
例
以下は、この機能の使用法です-
<?php
//Read and write for owner, nothing for everybody else
chmod("hello.txt", 0600);
//Read and write for owner, read for everybody else
chmod("hello.txt", 0644);
//Everything for owner, read and execute for others
chmod("hello.txt", 0755);
//Everything for owner, read and execute for owner's group
chmod("hello.txt", 0750);
?>