Php chmod defines and uses the chmod attribute () function to change the permissions of a specified file. If TRUE or FALSE is returned, the operation fails.
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.
// Read and write for owner, who reads and writes nothing for, is not the owner of other chmod ("test.txt", 0600); // Read and write for Read/write, 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);?>