我有一个工作代码,用于将文件传递给用户下载它。但最近我将我的网站模板更改为Flat UI desing,现在而不是将其打印的文件下载到页面页脚。
Php代码:
$FileToGet = "C:\\test\\test.exe";
if (file_exists($FileToGet )) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($FileToGet));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($FileToGet));
ob_clean();
flush();
readfile($FileToGet);
exit;
}
它打印到页脚的内容:
MZ����@��� �!�L�!This program cannot be run in DOS mode. $[�������������:�����,������<� �����������+�{����=�����;�����>����Rich���PEL�ЕR� V<(�p@� ��3\������sp�@pt.text�TV