The role of the chgrp() function in PHP is to change the user group to which a file or directory belongs.

WBOY
Release: 2023-09-12 15:48:01
forward
796 people have browsed it

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,

Syntax

chgroup($file_path, group)
Copy after login

Parameters

  • file_path - Set the path of the file or directory to be checked. Required.

  • group -Set the new user group name or number.

Return

chgroup() function returns.

  • Return True on success, False on failure
  • < /ul>

    Example

    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");
    ?>
    Copy after login

    Output

    TRUE
    TRUE
    Copy after login

    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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template