「PHP初心者」ファイル拡張子を取得する方法まとめ

方法1
function get_file_type_startnews24($filename)
{
$type =explode(“." , $filename);
$count=count($type)-1;
return $type[$count];
}

方法2
function get_file_type_startnews24($filename)
{
$type = pathinfo($filename);
$type = strtolower($type[“extension"]);
return $type;
}

方法3
function get_file_type_startnews24($filename){
$type = substr($filename, strrpos($filename, “.")+1); return $type;
}

PHP

Posted by arkgame