当我在我的服务器上上传时,它会显示错误:
调用未定义的函数finfo_open()
,但是在localhost上它可以工作。
$img_file= $row['CERT_IMAGE'];
$type1="../img/certImg/".$img_file;
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$type = getMIMEType($type1);
echo $type;
function getMIMEType($type1){
$finfo = finfo_open();
$fileinfo = finfo_file($finfo, $type1, FILEINFO_MIME_TYPE);
finfo_close($finfo);
return $fileinfo;
}
<td width="5%" align="center"><strong>:</strong></td>
<?php
if($type == "application/pdf")
{
?>
<td width="55%" align="left"><iframe src="../img/certImg/<?php echo
$img_file;?>" style="width:200px; height:300px;" frameborder="0"></iframe>
<br>
<a class="btn btn-primary" id="btnSubmit" target="_blank"
href="../img/certImg/<?php echo $img_file;?>" style="font-size:20px; ">View
Pdf</a>
</td>
<?php
} else {
?>
<td width="55%" align="left"><img src="../img/certImg/<?php echo $img_file;
?>" id="myImg" width="200px" height="300px"></td>
<?php } ?>
</tr>
答案 0 :(得分:0)
确保在php.ini中启用了fileinfo.so或php_fileinfo.dll
extension=fileinfo.so or extension=php_fileinfo.dll