head里面加的,按照自己的应用修改,(php)码,网上找的 header("Content-Type: application/vnd.ms-excel; charset=UTF-8"); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment;filename=11.xls "); header("Content-Transfer-Encoding: binary "); 自己的asp码 Set objFso=Server.Createobject("ADODB.Stream") With objFso .Type = 2 .Mode = 3 .Open .Charset = "UTF-8" .WriteText body '文本内容,流的话用wirte .Position = 0 .Type = 1 txtData = .Read '输出数据流,输出文本用ReadText txtSize = .Size .Close End With Set objFso = Nothing response.expires=0 response.addHeader "pragma","no-cache" response.addHeader "Cache-Control","no-cache, must-revalidate, post-check=0, pre-check=0" Response.addHeader "Content-Transfer-Encoding","binary" Response.AddHeader "Content-Disposition", "attachment; filename=文件名.txt" '文件名.后缀名 Response.AddHeader "Content-Length", txtSize Response.CharSet = "UTF-8" Response.ContentType = "application/octet-stream"'"application/force-download" Response.BinaryWrite txtData Response.Flush