1. 程式人生 > >獲取檔案型別使用 finfo_file 內建函式

獲取檔案型別使用 finfo_file 內建函式

今天檢視PHP文件發現原有的 mime_content_type 已廢棄,可以使用 finfo_file 內建函式

$finfo finfo_open(FILEINFO_MIME_TYPE); // 返回 mime 型別

foreach (glob("*") as $filename) {
    echo 
finfo_file($finfo$filename) . "\n";
}
finfo_close($finfo);