日期:2014-05-17 浏览次数:20493 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>资料下载</title>
</head>
<body>
<?php
$file_name="a.txt";
$file_dir="./";
if(!file_exists($file_dir.$file_name)){
echo "文件找不到";
exit;
}else{
$file=fopen($file_dir.$file_name,"r");//打开文件
echo($file_dir.$file_name);
Header("Content-type: application/octet-stream");
Header("Accept-Ranges:bytes");
Header("Accept-Length:".filesize($file_dir.$file_name));
Header("Content-Disposition: attachment; filename=".$file_name);
}
?>
</body>
</html>