您可以在下载后立即将其删除.输出文件的内容,然后关闭unlink它.
编辑:示例
$fo = fopen($f, 'rb') ;
$content = fread($fo, filesize($f)) ;
fclose($fo) ;
}
// Stream the file to the client
header("Content-Type: application/octet-stream");
header("Content-Length: " . strlen($archive));
header("Content-Disposition: attachment; filename=\"myfile.exe\"");
echo $archive;
unlink($f);
Run Code Online (Sandbox Code Playgroud)