function DownloadFile($parameters){ $fsize = filesize($parameters['filepath']); apache_setenv('no-gzip', 1); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Content-Length: " . $fsize); if(preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) { header('Content-Disposition: attachment; filename="' . iconv('UTF-8', 'GBK', $parameters['name']) . '"'); } else if(strstr($_SERVER['HTTP_USER_AGENT'], 'Firefox')){ header('Content-Disposition: attachment; filename="' . $parameters['name'] . '"'); } else { header('Content-Disposition: attachment; filename="' . $parameters['name'] . '"'); } header("Content-Transfer-Encoding: binary");
header('Content-type: application/force-download');
//header("Content-Type: application/zip"); //zip格式的
readfile($parameters['filepath']);
}
把以前写的东西整理一下,发出来