来看一个简单的demo:
function get_file_suffix($file_name, $allow_type = array()){
$file_suffix = strtolower(array_pop(explode('.', $file_name)));
if (empty($allow_type)){
return $file_suffix;
}else{
if (in_array($file_suffix, $allow_type)){
return true;
}else{
return false;
}
}
}