这在PHP 5中有效,但是现在不行了:
if (function_exists('finfo_open')) {
$mime = finfo_open(FILEINFO_MIME_TYPE);
$mime_type = finfo_file($mime, "FILE-PATH");
if($mime_type == array("application/pdf", "image/jpeg", "image/png"))
echo "file is pdf";
else
echo "file is not pdf";
finfo_close($mime);
}
慕无忌1623718