pathinfo函数
pathinfo() 函数以数组或字符串的形式返回关于文件路径的信息
语法pathinfo(path,options)
参数解析
可能的值:
PATHINFO_DIRNAME - 只返回 dirname
PATHINFO_BASENAME - 只返回 basename
PATHINFO_EXTENSION - 只返回 extension
PATHINFO_FILENAME - 只返回 filename
示例
<?php
var_dump(pathinfo("/testweb/test.txt",PATHINFO_DIRNAME));
var_dump(pathinfo("/testweb/test.txt",PATHINFO_BASENAME));
var_dump(pathinfo("/testweb/test.txt",PATHINFO_EXTENSION));
var_dump(pathinfo("/testweb/test.txt",PATHINFO_FILENAME));
?>
输出
string(8)"/testweb"
string(8)"test.txt"
string(3)"txt"
string(4)"test"
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。