PHP判断图片格式

原创
2016-06-23 13:17:24 1237浏览

$imgurl = "http://finalshares.com/themes/site/biv_viva/images/logo.png" ;

//方法1

echo $ext = strrchr ( $imgurl , '.' );

echo '


' ;

//方法2

echo $ext1 = substr ( $imgurl , strrpos ( $imgurl , '.' ));

echo '


' ;

//方法3

echo (@ end ( explode ( "." , $imgurl )));

echo '


' ;

//方法4

echo pathinfo ( $imgurl ,PATHINFO_EXTENSION);

print_r( pathinfo ( $imgurl ));

echo '


' ;

//方法5

$imginfo = getimagesize ( $imgurl );

print_r( $imginfo );

echo end ( $imginfo );

echo '


' ;

//方法6

$imghttp = get_headers( $imgurl ,true);

print_r( $imghttp );

echo '


' ;

//方法7

echo exif_imagetype( $imgurl );


声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。