PHP readfile()在使用https时出现图像损坏问题

PHP readfile()在使用https时出现图像损坏问题,php,image,https,readfile,Php,Image,Https,Readfile,我们用PHP开发了一个gallery应用程序,它可以显示图像列表。早些时候,这个图库是用Http托管的,运行良好。最近我们将代码移动到https。在那里,我们面临着一个奇怪的问题。某些图像未加载(尽管某些图像已加载)。最终,当我们使用Http时,所有的内容都被正确加载(在同一个主机中)。请注意,当您有多个图像时,会出现此问题。对于单个图像,代码在https中运行良好 示例代码如下所示: loadImage.php <?php $fileId = $_GET['id']; $filePath

我们用PHP开发了一个gallery应用程序,它可以显示图像列表。早些时候,这个图库是用Http托管的,运行良好。最近我们将代码移动到https。在那里,我们面临着一个奇怪的问题。某些图像未加载(尽管某些图像已加载)。最终,当我们使用Http时,所有的内容都被正确加载(在同一个主机中)。请注意,当您有多个图像时,会出现此问题。对于单个图像,代码在https中运行良好

示例代码如下所示:

loadImage.php

<?php
$fileId = $_GET['id'];
$filePath = getFilePath($fileId);
if(file_exists($filePath) && isset($filePath)){
   $path = $filePath;
} else {    
   $path = "img/default.jpg";
}
$getInfo = getimagesize($path);
header('Content-type: ' . $getInfo['mime']);
header('Content-Length: ' . filesize($path));
readfile($path);
?>

testImage.html

<html>
 <img src="loadImage.php?id=1">
</html>


请帮助解决此问题。

确保证书有效且可以得到验证。控制台是否抛出任何错误?发布的代码是否传递了损坏的图像?另外,为什么您的
ob_clean()
flush()
没有
ob_start()
,或者您从发布的
loadImage.php
中删除了任何代码?证书有效且经过验证。控制台中没有错误。ob_start()在标题中(我没有在这里添加该部分)
loadImage.php
与我使用的相同。代码仍然不起作用。这是我正在使用的原始代码。请帮助解决这个问题。