方法1:
function get_file_type($filename){
$type = substr($filename, strrpos($filename, ".")+1);
return $type;
}
方法2:
function get_file_type($filename)
{
$type = pathinfo($filename);
$type = strtolower($type["extension"]);
return $type;
}
方法3:
function get_file_type($filename)
{
$type =explode("." , $filename);
$count=count($type)-1;
return $type[$count];
}
方法4:
function getExt1($filename)
{
$arr = explode('.',$filename);
return array_pop($arr);;
}
方法5:
function getExt2($filename)
{
$ext = strrchr($filename,'.');
return $ext;
}
方法6:
function getExt3($filename)
{
$pos = strrpos($filename, '.');
$ext = substr($filename, $pos);
return $ext;
}
方法7:
function getExt4($filename)
{
$arr = pathinfo($filename);
$ext = $arr['extension'];
return $ext;
}
方法8:
function getExt5($filename)
{
$str = strrev($filename);
return strrev(strchr($str,'.',true));
}