PHP查询文件扩展名

复制代码

 1 //查询文件扩展名
 2 function extension($str){
 3     $str = implode("",explode("\",$str));
 4     $str = explode(".",$str);
 5     $str = strtolower(end($str));
 6     return $str;
 7 }
 8 
 9 $file = 'D://a
ame-Of_somefile.File.txt';
10 echo extension($file);
原文地址:https://www.cnblogs.com/pcyy/p/5769515.html