PHP获取文件后缀名的几种方法
原文出处:http://www.supidea.com/post/php-get-file-type.aspx
<?
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];
}
?>
作者:恶魔的果实
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.

浙公网安备 33010602011771号