PHP dirname() 函数

定义和用法
dirname() 函数返回路径中的目录名称部分。
语法
dirname(path)
参数 | 描述 |
---|---|
path | 必需。规定要检查的路径。 |
实例
<?php
echo dirname("c:/testweb/home") . "<br />";
echo dirname("/testweb/home");
?>
echo dirname("c:/testweb/home") . "<br />";
echo dirname("/testweb/home");
?>
上面的代码将输出:
c:/testweb
/testweb
/testweb
