我希望通过URL使用PHP获取文件类型(例如.image/gif).我试过了
<?php
$image_path="http://fc04.deviantart.net/fs71/f/2010/227/4/6/PNG_Test_by_Destron23.png";
exif_imagetype($image_path);
?>
Run Code Online (Sandbox Code Playgroud)
上面的代码给了我一个空白页面,下面的代码返回"3":
<?php
$image_path="http://fc04.deviantart.net/fs71/f/2010/227/4/6/PNG_Test_by_Destron23.png";
echo exif_imagetype($image_path);
?>
Run Code Online (Sandbox Code Playgroud)
我哪里错了?解决:使用Fileinfo获取内容类型