BaseName
Returns a file string that does not contain a path.
Syntax: string basename (string path);
return value: String
Function Type: File access
Content Description: Remove the path and file string, and return a string containing only the filename. In the Windows family operating system, the path can be a slash (/) or backslash (\), and a diagonal (/) path in the UNIX-series operating system.
Usage examples
The $file variable value in the following example is "index.php"
<?php
$path = "/home/httpd/html/index.php";
$file = basename($path);
?>
Reference dirname ()
Chgrp
Change the group to which the file belongs.
Syntax: int chgrp (string filename, mixed group);
return value: Integer
Function Type: File access
Content Description This function is used to change the group the file belongs to, only the system administrator permissions can arbitrarily change the file belongs to the group, the rest of the users can only change their own files. Success returns TRUE, Failure returns false; in the Windows family operating system, this function returns true without doing anything.
Reference Chown () chmod ()
chmod
Change the properties of the file.
Syntax: int chmod (string filename, int mode);
return value: Integer
Function Type: File access
Content Description: This function is used to change the properties of the file. Success returns TRUE and Failure returns false. In the mode value, the system does not automatically add it to 0 to get the correct octal calculus, and to use it correctly, you can use the second line in the following example.
Usage examples
The next two lines are to set the file property to Rwxr-xr-x, but the second row is better.
<?
chmod("/mydir/myfile", 755 ); // mode 为十进位,可能有潜在错误
chmod("/mydir/myfile", 0755 ); // mode 为八进位,确定的属性值
?>
Reference Chown () chgrp ()