How to use php dirname function

藏色散人
Release: 2023-04-05 10:28:01
Original
2749 people have browsed it

php The dirname() function returns the directory part of the path. Its syntax is [dirname(path)]. The parameter path is required and refers to the path to be checked.

How to use php dirname function

php dirname function usage:

php dirname() function syntax

Function: Returns the directory portion of the path.

Syntax:

dirname(path)
Copy after login

Parameters:

path Required. Specifies the path to be checked.

Explanation: The

path parameter is a string containing the full path to a file. This function returns the directory name after removing the file name.

php dirname() function example

<?php
$file = "/phpstudy/WWW/index.php";
echo dirname($file);
?>
Copy after login

Output:

/phpstudy/WWW
Copy after login

This article is an introduction to the PHP dirname function. I hope it will be helpful to friends who need it. Helps!

The above is the detailed content of How to use 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!