Phpchmod function change file mode _ PHP Tutorial

Source: Internet
Author: User
The phpchmod function changes the file mode. When operating files, we often use the chmod function to change the operation permissions of the specified directory. when operating files, we often use the chmod function to change the operation permissions of the specified directory, when operating files, we often use the chmod function to change the operation permissions of the specified directory,

When operating files, we often use the chmod function to change the operation permissions of the specified directory,

Attribute
(PHP 4 and PHP 5)

Change file mode with chmod

Description
Boolean attribute (string $ file name, International $ mode)
Attempts to change the file specified by the mode in the provided mode.

Parameters

File name
File path.

Mode
Note that the mode is not automatically assumed to be the octal value, so the string (such as "Gram + Watt") will not work properly. To ensure the expected operation, you need to set the prefix mode to zero (0 ):

Chmod ("/somedir/somefile", 755); // decimal; probably incorrect
Chmod ("/somedir/somefile", "u + rwx, go + rx"); // string; incorrect
Chmod ("/somedir/somefile", 0755); // octal; correct value of mode
?>

This mode parameter contains three octal components that specify the owner of the access restriction. The owner of the user group is in the same order as others. An integral part can be computed, adding the necessary permissions to this target user group. Number 1 indicates that you are granted the execution right, number 2 indicates that your file is written, and number 4 indicates that your file is readable. These numbers are purchased to specify the required rights. You can also read

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.