Latest web development tutorials

PHP dirname () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

dirname () function returns the path name of the directory section.

grammar

dirname(path)

参数 描述
path 必需。规定要检查的路径。


Examples

<?php
echo dirname("c:/testweb/home.php") . "<br />";
echo dirname("/testweb/home.php");
?>

The code above will output:

c:/testweb
/testweb


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual