lchgrp
Modify all groups of symbolic links
Function name: lchgrp()
Function description: The lchgrp() function is used to modify the group to which a file or directory belongs, similar to the chgrp() function. The difference is that the lchgrp() function can operate on a symbolic link, while the chgrp() function can only operate on the target pointed to by the symbolic link.
Applicable version: The lchgrp() function is available in PHP 4.0.5 and later.
Syntax: bool lchgrp ( string $filename , mixed $group )
parameter:
Return value: Return true on success, and false on failure.
Example 1: Modify the file's group to "admin".
$filename = '/path/to/file.txt'; $group = 'admin'; if (lchgrp($filename, $group)) { echo "所属组修改成功!"; } else { echo "所属组修改失败!"; }
Example 2: Modify the group to which the directory belongs to a group with a group ID of 1000.
$dirname = '/path/to/directory'; $group = 1000; if (lchgrp($dirname, $group)) { echo "所属组修改成功!"; } else { echo "所属组修改失败!"; }
Notes: