Home > Article > Backend Development > The role of the chgrp() function in PHP is to change the user group to which a file or directory belongs.
chgroup() function updates the file group. Remember, only superuser has permission to arbitrarily change the file's group,
chgroup($file_path, group)
file_path - Set the path of the file or directory to be checked. Required.
group -Set the new user group name or number.
chgroup() function returns.
The following example checks the file "one.txt" and changes its filegroup.
<?php $file_path1 = "/themes/myfiles/one.php"; $file_path2 = "/themes/myfiles/two.php"; // changing groups of two files chgrp($file_path1, "admin"); chgrp($file_path2, "guest"); ?>
TRUE TRUE
The above is the detailed content of The role of the chgrp() function in PHP is to change the user group to which a file or directory belongs.. For more information, please follow other related articles on the PHP Chinese website!