• <bdo id="oq0yq"><xmp id="oq0yq">
    <menu id="oq0yq"></menu>
  • 建站常識

    ASP 批量分批生成靜態文件

    發布時間 | 2016/10/18  點擊 | 

    ASP批量生成靜態HTML的實例程序,可以批量生成,也可以批量刪除,頁面沒有怎么美化,關鍵是想實現ASP生成靜態的功能。生成HTML速度很快

    Dim StarTime
    Dim cnt:cnt = 1
    StarTime = Timer()

    start = request("start") '獲取本輪指針的開始位置
    If IsNumeric(start) Then start = CLng(start) Else start=1
    If start=0 Then start = 1

    set rs4=server.createobject("adodb.recordset")
    sql="select * from gjc"
    rs4.open sql,conn,1,1
    rs4.AbsolutePosition = start
    while not rs4.eof and cnt < 21
    k=rs4("tags")
    py=rs4("pinyin")
    title=rs4("title")

    Call CheckAndCreateFolder("/ganxi/"&py)
    FileName="/ganxi/"&py&"/index.html" '要生成的文件路徑及地址
    UrlPath ="http://www.021jz.com.cn/2.asp?key="&k&"&t="&title&"&"
    Call SaveToFile(FileName,GetTheHTMLCode(UrlPath))

    cnt = cnt + 1
    start = start + 1
    rs4.movenext
    wend
    if not rs4.eof Then '通過刷新的方式進行下一輪請求,并將指針變量start傳遞到下一輪
    response.write "<meta http-equiv='refresh' content='0;URL=?start="&start&"'>"
    else

    Dim EndTime
    EndTime = Timer()
    sj=FormatNumber((EndTime - StarTime) * 1000, 3)
    sj=sj/1000

    response.write "<script language='javascript'>" & chr(13)
    response.write "alert('批量生成成功,所需時間:"&sj&" 秒');" & Chr(13)
    response.write "window.document.location.href='index.asp?page="&pg&"';"&Chr(13)
    response.write "</script>" & Chr(13)
    Response.End
    end if

    相關信息