代码: if SaveFile("/new/"&id&".html","http://127.0.0.1/newss.asp?id="&id&"") then 中 /new"&id&".html",是你生成的文件和路径。http://127.0.0.1/news.asp?id="&id&""是asp的路径 大家可以自己设置修改,其中 "&id&" 是读取浏览器的变量。网址改成你自己的。 使用方法,给你的文章列表添加一个连接,如 http://127.0.0.1/shengcheng.asp?id=90 90这个变量相信大家会调用吧,这样就能在/new目录下生成按照id排列的html文章了 演示看:http://www.hotlt.com/movie/537.html 程序代码 Dim id id = Request("id") %> <% if SaveFile("/new/"&id&".html","http://127.0.0.1/news.asp?id="&id&"") then Response.write "已生成" else Response.write "没有生成" end if function SaveFile(LocalFileName,RemoteFileUrl) Dim Ads, Retrieval, GetRemoteData On Error Resume Next Set Retrieval = Server.CreateObject("Microso" & "ft.XM" & "LHTTP") With Retrieval .Open "Get", RemoteFileUrl, False, "", "" .Send GetRemoteData = .ResponseBody End With Set Retrieval = Nothing Set Ads = Server.CreateObject("Ado" & "db.Str" & "eam") With Ads .Type = 1 .Open .Write GetRemoteData .SaveToFile Server.MapPath(LocalFileName), 2 .Cancel() .Close() End With Set Ads=nothing if err <> 0 then SaveFile = false err.clear else SaveFile = true end if End function %> |