Home  >  Article  >  Backend Development  >  Usage of php dirname() function

Usage of php dirname() function

怪我咯
怪我咯Original
2017-07-10 16:13:411520browse

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)
##ParametersDescriptionpathRequired. Specifies the path to be checked. suffixOptional. Specifies the file extension. If the file has suffix, this extension will not be output.
basename() function code is as follows:

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!

Statement:
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