string dirname ( string $path );
给定一个包含文件路径的字符串,此函数将返回目录的名称。
path - 文件路径
它返回给定路径的基本名称。
链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-dirname.html
来源:LearnFk无涯教程网
<?php $path="/home/httpd/html/index.php"; $dir=dirname($path); echo "dirname is $dir\n"; ?>
这将产生以下输出-
dirname is /home/httpd/html
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)