我把程序贴出来,各位帮忙看看吧!
if lcase(request.servervariables("HTTPS"))= "off" then
strtemp="http://"
else
strtemp="https://"
end if
if lcase(request.servervariables("SERVER_NAME"))="localhost" then
strtemp=strtemp&"127.0.0.1"
else
strtemp=strtemp&trim(request.servervariables("SERVER_NAME"))
end if
set cs=server.createobject("adodb.recordset")
csql="select * from aa where fl='bb'"
cs.open csql,conn,1,3
set fso=server.createobject("scripting.filesystemobject")
if not (cs.bof and cs.eof) then
for c=1 to cs.recordcount
if trim(cs("html"))="" or isnull(cs("html")) then ‘html基本不为空,如果为空的话,则生成路径
fpath="wzfl/"&trim(getpy(trim(cs("xlmc")))) 'getpy是一个生成路径的函数,
path="/"&fpath&"/"
if not fso.folderexists(server.mappath(path)) then
fso.CreateFolder(server.mappath(path))
end if
if trim(cs("html"))="" or isnull(cs("html")) then
cs("html")=path
cs.update
end if
else
path=trim(cs("html"))
end if
url=strtemp&"/newwzfl.asp?wzlx="&trim(cs("id"))
'根据传过去的参数生成相应的内容
sql="select * from wzljl where lxx="&trim(cs("id"))
mysl=25
path=path
call sclist(url,sql,mysl,path,"fl")
cs.movenext
next
response.write "<script>alert('文字分类全部生成,共"&cs.recordcount&"个分类');</script>"
end if
cs.close
set cs=nothing
set csql=nothing
set fso=nothing
sub sclist(url,sql,mysl,path,fl)
if not isobject(conn) then connectiondatabase
set ors=server.createobject("adodb.recordset")
osql=sql
ors.open osql,conn,1,1
if not (ors.bof and ors.eof) then
me_record=mysl
if (ors.recordcount) mod me_record = 0 then
zpage=int((ors.recordcount)/me_record)
else
zpage=int((ors.recordcount)/me_record)+1
end if
for j=1 to zpage
Set Http = CreateObject("Msxml2.ServerXMLHTTP.3.0")
set objstream = Server.CreateObject("adodb.stream")
if j=1 then
filename="\index.htm"
else
filename="\list_"&j&".htm"
end if
fpath=server.mappath(path)
fileurl=fpath&filename
lResolve = 500 * 1000
lConnect = 500 * 1000
lSend = 1500 * 1000
lReceive = 1500 * 1000
Http.setTimeouts lResolve, lConnect, lSend, lReceive
if fl="fl" then
web=url&"&page="&j
else
web=url&"?page="&j
end if
Http.open
"GET" ,web,false
Http.send()
html_code=Http.responseBody
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write html_code
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
objstream.SaveToFile(fileurl),2
'response.write fileurl&"
写入成功!<br>"
objstream.close
set objstream=nothing
set Http=nothing
next
end if
ors.close
set ors=nothing
set osql=nothing
end sub