Php chmod definition and usage
The chmod attribute () function changes the permission of the specified file. If TRUE or FALSE is returned, the operation fails.
Syntax
Chmod (file, mode)
File |
Required. Specified file check
|
Mode |
Required. Specify new permissions. The parameter mode consists of four numbers: first, the number of permissions is always zero. Second, the number of permissions specified by the owner. Third, the number of user groups specified by the permission owner. Fourth, the number of permissions specified by the permission owner. Others can be assigned (set multiple permissions and add the following number):
1 = execution permission
2 = write permission
4 = read permission
|
Let's take a look at the instance.
<? Php
// Read and write for owner, the person who reads and writes nothing for, not for others
Chmod ("test.txt", 0600); // Read and write for Read/write Master, Read by others
Chmod ("test.txt", 0644); // Everything for all Masters, read and execute others
Chmod ("test.txt", 0755); // Everything for everyone, read the owner's group
Chmod ("test.txt", 0740 );
?>