lup*_*tus 25
您可以使用image_type_to_extension返回的图像类型的函数getimagesize:
$info = getimagesize($path);
$extension = image_type_to_extension($info[2]);
Run Code Online (Sandbox Code Playgroud)
小智 6
您还可以使用strrpos和substr函数来获取任何文件的扩展名
$filePath="images/ajax-loader.gif";
$type=substr($filePath,strrpos($filePath,'.')+1);
echo "file type=".$type;
Run Code Online (Sandbox Code Playgroud)
输出:gif
如果你想扩展像.gif
$type=substr($filePath,strrpos($filePath,'.')+0);
Run Code Online (Sandbox Code Playgroud)
输出:.gif
| 归档时间: |
|
| 查看次数: |
36075 次 |
| 最近记录: |