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\b\name-Of_somefile.File.txt';
10 echo extension($file);

posted on 2016-08-14 09:26  一坪海岸线y  阅读(137)  评论(0编辑  收藏  举报

导航