Latest web development tutorials

PHP umask () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

umask () function to change the file permissions of the file.

The function of the PHP's umask tomask & 0777and returns the old umask. However, with no parameters, if you call umask (), it returns the current umask.

grammar

umask(mask)

参数 描述
mask 可选。规定新的权限。默认是 0777。

mask 参数由四个数字组成:

  • 第一个数字通常是 0
  • 第二个数字规定所有者的权限
  • 第三个数字规定所有者所属的用户组的权限
  • 第四个数字规定其他所有人的权限

可能的值(如需设置多个权限,请对下面的数字进行总计):

  • 1 = 执行权限
  • 2 = 写权限
  • 4 = 读权限


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual