Php chmod function tutorial

Source: Internet
Author: User

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);?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.