PHP | imagetypes()函数

imagetypes()函数是PHP中的内置函数,用于返回PHP内置安装库支持的图像类型。

null

语法:

int imagetypes( void )

参数: 此函数不接受任何参数。

返回值: 此函数返回与链接到PHP的GD版本支持的图像格式相对应的位字段。此函数返回以下位:IMG_BMP、IMG_GIF、IMG_JPG、IMG_PNG、IMG_WBMP、IMG_XPM、IMG_WEBP。

下面的程序演示了PHP中的imagetypes()函数:

项目1:

<?php
if (imagetypes() & IMG_PNG) {
echo "PNG Support is enabled" ;
}
else {
echo "Not supported image type." ;
}
?>


输出:

PNG Support is enabled

项目2:

<?php
if (imagetypes() & IMG_JPEG) {
echo "JPEG Support is enabled" ;
}
else {
echo "Not supported image type." ;
}
?>


输出:

JPEG Support is enabled

相关文章:

参考: http://php.net/manual/en/function.imagetypes.php

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享