0

当我将其上传到我的服务器上时,它会显示错误:

调用未定义函数 finfo_open()

, 但在本地主机上它可以工作。

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

4

1 回答 1

0

确保在 php.ini 中启用了 fileinfo.so 或 php_fileinfo.dll

extension=fileinfo.so or extension=php_fileinfo.dll
于 2018-04-21T11:27:52.323 回答