Home  >  Article  >  Backend Development  >  php umask function tutorial_PHP tutorial

php umask function tutorial_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:01:141216browse

php umask function tutorial ​

umask value
(PHP 4, PHP 5)

umask - changes the current umask

Description
int umask ( [int $mask] )
umask() sets the PHP umask value to mask and 0777 and returns the old umask. When PHP is used as a server module, umask is restored when each request is completed.

Parameters

Mask
new umask.


Return value
umask value() without arguments returns only the current umask otherwise the old umask is returned.

Example

Example of umask() for example #1

$old = umask(0);
chmod("/path/some_dir/some_file.txt", 0755);
umask($old);

// Checking
if ($old != umask()) {
Die('An error occurred while changing back the umask');
}
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445464.htmlTechArticlephp umask function tutorial umask value (PHP 4, PHP 5) umask - changes the current umask description int umask ([int $mask]) umask() sets the PHP umask value to mask...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn