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

 

原文出处:http://www.supidea.com/post/php-get-file-type.aspx 
 

 
<?
PHP获取文件后缀名的几种方法1:
function get_file_type($filename){
    $type = substr($filenamestrrpos($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 @ 2012-10-25 13:44  恶魔的果实  阅读(143)  评论(0)    收藏  举报