basename()Functiongives a string containing the full path to a file, and the value it returns is the base file name, It can also be considered as an extension of the pathinfo() function:
Syntax
basename(path,suffix)
Description | |
---|---|
Required. Specifies the path to be checked. | |
Optional. Specifies the file extension. If the file has suffix, this extension will not be output. |
echo basename($path); //输出结果:myphoto.jpg //或者 basename("/www/mywebsite/images/"); //输出结果:images
The above is the detailed content of Usage of php dirname() function. For more information, please follow other related articles on the PHP Chinese website!