小白教程
所有教程
关于
Search
172.71.254.6
172.71.254.6
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func filesystem pathinfo”的源代码
本页内容
上一节:
Func_filesystem_parse_ini_file
下一节:
Func_filesystem_pclose
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:pathinfo()}}[[Category:PHP Filesystem 文件系统参考手册|59]] = PHP pathinfo() 函数 = [[Category:PHP Filesystem 文件系统参考手册]] == 定义和用法 == pathinfo() 函数以数组的形式返回关于文件路径的信息。 返回的数组元素如下: * [dirname]: 目录路径 * [basename]: 文件名 * [extension]: 文件后缀名 * [filename]: 不包含后缀的文件名 == 语法 == <pre> pathinfo(path,options) </pre> {| class="table table-striped table-hover" !width="50%"| 参数 !width="50%"| 描述 |- | path | 必需。规定要检查的路径。 |- | options | 可选。规定要返回的数组元素。默认是 all。 可能的值: * PATHINFO_DIRNAME - 只返回 dirname * PATHINFO_BASENAME - 只返回 basename * PATHINFO_EXTENSION - 只返回 extension * PATHINFO_FILENAME - 只返回 filename |} == 提示和注释 == '''注释:'''如果不是请求所有的元素,则 pathinfo() 函数返回字符串。 == 实例 1 == <sample title="" desc="" lang="php" hererun="1"> <?php print_r(pathinfo("/testweb/test.txt")); ?> </sample> 上面的代码将输出: <sample title="" desc="" lang="php" hererun="1"> Array ( [dirname] => /testweb [basename] => test.txt [extension] => txt [filename] => test ) </sample> == 实例 2 == <sample title="" desc="" lang="php" hererun="1"> <?php print_r(pathinfo("/testweb/test.txt",PATHINFO_BASENAME)); ?> </sample> 上面的代码将输出: <sample title="" desc="" lang="php" hererun="1"> test.txt </sample> [[Category:PHP Filesystem 文件系统参考手册]]
返回至“
Func filesystem pathinfo
”。
上一节:
Func_filesystem_parse_ini_file
下一节:
Func_filesystem_pclose