$file = "upload/123.jpg";
$finfo = finfo_open(FILEINFO_MIME_TYPE);
foreach (glob("*") as $file) {
echo finfo_file($finfo, $file) . "\n";
}
finfo_close($finfo);
text/x-php directory text/x-php text/x-php directory text/x-php text/x-php directory text/html directory text/x-php directory text/x-php text/html
$file = "upload/123.jpg";
$isImage = explode("/", mime_content_type($file))[0] == "image";
if($isImage){}else{}