PHP:exif_imagetype()函数如何接受JPG文件(而不是JPEG文件)?

I'm using the PHP exif_imagetype() function, and trying to accept these types of images:

IMAGETYPE_PNG

IMAGETYPE_JPEG

IMAGETYPE_GIF

But there's no IMAGETYPE_JPG imagetype constant, so all .jpg files are not accepted. Is there any solution to this?

IMAGETYPE_JPEG works for files with extensions jpg and jpeg :

var_dump(exif_imagetype ( "abc.jpg" ) == IMAGETYPE_JPEG);
var_dump(exif_imagetype ( "abc.jpeg" ) == IMAGETYPE_JPEG);

outputs

bool(true)
bool(true)

There is no difference between .jpeg and .jpg files. You do not need to treat them separately.

JPG is an abbreviation for JPEG, originally only used on DOS systems which did not support filename extensions longer than three characters.