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):
|
Технические детали
Возвращаемое значение: | ИСТИНА в случае успеха, ЛОЖЬ в случае неудачи |
---|---|
Версия PHP: | 4.0+ |
❮ Справочник по файловой системе PHP