dirname() - 语法
string dirname ( string $path );
给定一个包含文件路径的字符串,此函数将返回目录的名称。
path - 文件路径
dirname() - 返回值
它返回给定路径的基本名称。
dirname() - 示例
<?php $path="/home/httpd/html/index.php"; $dir=dirname($path); echo "dirname is $dir\n"; ?>
这将产生以下输出-
dirname is /home/httpd/html