PHP中获取文件扩展名的N种方法从网上收罗的,基本上就以下这几种方式:第1种方法:function get_extension($file){substr(strrchr($file, .), 1);}第2种方法:function get_...
function get_extension($file)
{
substr(strrchr($file, '.'), 1);
}
function get_extension($file)
{
return substr($file, strrpos($file, '.')+1);
}
function get_extension($file)
{
return end(explode('.', $file));
}
function get_extension($file)
{
$info = pathinfo($file);
return $info['extension'];
}
function get_extension($file)
{
return pathinfo($file, PATHINFO_EXTENSION);
}
