PHP获取文件后缀名的三种方法

如下:

<? 
PHP获取文件后缀名的几种方法1: 
function get_file_type($filename){ 
$type = substr($filename, strrpos($filename, ".")+1); 
return $type; 
} 
PHP获取文件后缀名的几种方法2: 
function get_file_type($filename) 
{ 
$type = pathinfo($filename); 
$type = strtolower($type["extension"]); 
return $type; 
} 
PHP获取文件后缀名的几种方法3: 
function get_file_type($filename) 
{ 
$type =explode("." , $filename); 
$count=count($type)-1; 
return $type[$count]; 
} 
?>
posted @ 2014-04-10 13:55  phpxiebin  阅读(422)  评论(0编辑  收藏  举报