PHP dirname () function
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");
?>
echo dirname("c:/testweb/home.php") . "<br />";
echo dirname("/testweb/home.php");
?>
The code above will output:
c:/testweb
/testweb
/testweb
Complete PHP Filesystem Reference Manual