我已经完全允许该文件。并从php代码下载...以这种方式......
while (ob_get_level() > 0) {
ob_end_clean();
}
header("Content-Disposition: attachment; filename=" . urlencode(basename($filepath)), true);
header("Content-Transfer-Encoding: Binary", true);
header("Content-Type: application/force-download", true);
header("Content-Type: application/octet-stream", true);
header("Content-Type: application/download", true);
header("Content-Description: File Transfer", true);
header("Content-Length: " . filesize($filepath), true);
flush();
$fp = fopen($filepath, "r");
while (!feof($fp)) {
echo fread($fp, 65536);
// ob_clean();
flush();
}
fclose($fp);
但下载的文件显示zerobytes.Im无法得到完美的答案,你可以帮忙
答案 0 :(得分:1)
请在您的代码中注明以下一行并再试一次
标题(" Content-Length:" .cilesize($ filepath),true);