Usage of php dirname() function

怪我咯
Release: 2023-03-13 12:46:01
Original
1440 people have browsed it

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)
Copy after login
##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
Copy after login

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!

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!