您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php怎么查询文件名

2026/1/8 15:09:27发布10次查看
php查询文件名的方法:可以利用pathinfo()函数来查询。pathinfo()函数以数组的形式返回关于文件路径的信息,包括目录路径、文件名等,如:【print_r(pathinfo(/testweb/test.txt))】。
pathinfo() 函数以数组的形式返回关于文件路径的信息。
(推荐教程:php图文教程)
返回的数组元素如下:
[dirname]: 目录路径
[basename]: 文件名
[extension]: 文件后缀名
[filename]: 不包含后缀的文件名
语法:
pathinfo(path,options)
参数:
path 必需。规定要检查的路径。
options 可选。规定要返回的数组元素。默认是 all。
(视频教程推荐:php视频教程)
举例:
<?phpprint_r(pathinfo("/testweb/test.txt"));?>
输出结果:
array( [dirname] => /testweb [basename] => test.txt [extension] => txt [filename] => test)
以上就是php怎么查询文件名的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product