【发布时间】:2013-09-10 15:44:09
【问题描述】:
我正在使用此 PHP 代码开始下载,但想在开始下载之前/之后显示“HTML”,但以下代码会导致空白页面:
输出html的功能:
function writeMsg($msg)
{
echo "<html><body><h2>$msg</h2></body></html>";
}
调用使用:
if(file_exists ($fullpath)) {
//Start Download
ob_start();
writeMsg('Download Started');
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$fname\"");
header("Content-Transfer-Encoding: binary");
header('Connection: close');
ob_end_flush();
exit();
}
【问题讨论】:
标签: php file-io nginx http-headers