当我使用下面的头文件时,IE7会显示文件的内容,而不是下载提示。我在谷歌上搜索了al,但没有找到扩展。
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename=\"Copy van '.basename($file).'\"');
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($file));
ob_clean();
flush();
readfile($file);
exit;发布于 2013-02-23 19:15:47
当您要发送标头时,请确保它们是脚本的第一个输出。
这是行不通的:
<html> //==>output buffer
echo ... //==>output buffer
<?php header(...) ?>这是可行的:
<?php
session_start();
$some_variable=$_POST[];
$k="2";
//until here, nothing is send to the output buffer
header(...);
?>
<html>https://stackoverflow.com/questions/15033816
复制相似问题