//1)
function get_ext1($file_name)
{
return strrchr($file_name, '.');
}
//2)
function get_ext2($file_name)
{
return substr($file_name, strrpos($file_name, '.'));
}
//3)
function get_ext3($file_name)
{
return array_pop(explode('.', $file_name));
}
//4)
function get_ext4($file_name)
{
$p = pathinfo($file_name);
return $p['extension'];
}
//5)
function get_ext5($file_name)
{
return strrev(substr(strrev($file_name), 0, strpos(strrev($file_name), '.')));
}
PHP获取文件扩展名的五种方法
最新推荐文章于 2023-12-11 15:10:11 发布