Home >Backend Development >PHP Tutorial >PHP判断图片格式

PHP判断图片格式

WBOY
WBOYOriginal
2016-06-23 13:17:241551browse

$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 );


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn