我有以下代码强制下载IPA文件(在用脚本对其进行编码后)。 它适用于较小的文件,但文件较大,我的Web服务器开始返回500内部服务器错误。 有人能够帮助我调整现有代码来克服这个问题吗? p>
$ time = md5(time());
//在此处运行代码签名脚本
//然后尝试启动下载
$ path =“done / $ time /”;
$ latest_ctime = 0;
$ latest_filename ='';
$ d = dir($ path);
while(false!==($ entry = $ d-> read())){
$ filepath =“{$ path} / {$ entry} “;
if(is_file($ filepath)&& filectime($ filepath)> $ latest_ctime){
$ latest_ctime = filectime($ filepath);
$ latest_filename = $ entry;
}
}
header(“Cache-Control:public”);
header(“Content-Description:File Transfer”);
header(“Content-Disposition:attachment; filename = $ time.ipa”);
header(“Content-Type:application / ipa”);
header(“Content-Transfer-Encoding:binary”);
//从磁盘读取文件
readfile(“done / $ time /” 。$ latest_filename);
// header('location:dashboard.php');
} else {
// Throwback
die(“失败。联系支持.//< p> $ sign< / p>“);
}
code> pre>
div>