方法1:
function getExt1($fileName)
{
$arr = pathinfo($fileName);
$ext = $arr['extension'];
return $ext;
}
方法2:
function getExt2($fileName)
{
$arr = explode('.',$fileName);
return array_pop($arr);;
}
方法3:
function getExt3($fileName)
{
$ext = strrchr($fileName,'.');
return $ext;
}
方法4:
function getExt4($fileName)
{
$pos = strrpos($fileName, '.');
$ext = substr($fileName, $pos);
return $ext;
}
方法5:
function getExt5($fileName)
{
$str = strrev($fileName);
return strrev(strchr($str,'.',true));
}