• 24小時服務熱線:
  • 0838-6611186


☞ 您的位置:首頁 › > 代碼技巧

PJ3博客系統生成靜態首頁的簡單方法
          發布日期:2010-07-27 14:21:41 人氣: 標簽:靜態

下面的代碼存成一個asp頁面然后訪問一次即可!
注意IIS里的文檔要調為index.htm優先才可以,在官方的正式靜態沒出來前這是個不錯的臨時解決辦法,比之前的直接訪問動態頁面要爽多了,不用再死等服務器的處理了! (此代碼也適合其它首頁非靜態的處理)
< %
dim strUrl,Item_Classid,id,FileName,FilePath,Do_Url,Html_Temp
Html_Temp="

    "
    For i=1 To 1
    Html_Temp = Html_Temp&"
  • "
    Item_Classid = i
    FileName = "index.htm"
    FilePath = Server.MapPath("/")&"\"&FileName
    Html_Temp = Html_Temp&FilePath&""
    Do_Url = "http://"
    Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/default.asp"
    'Do_Url = Do_Url&"?Item_Classid="&Item_Classid
    strUrl = Do_Url
    call makehtml (strUrl,FilePath)
    Next
    Html_Temp = Html_Temp&"
      "
      Response.Write ( "首頁發布完成!" )
      Response.Write ( "
      " )
      Response.Write Html_Temp

       

      function makehtml(strUrl,FilePath)
      dim objXmlHttp
      set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
      objXmlHttp.open "GET",strUrl,false
      objXmlHttp.send()
      Dim binFileData
      binFileData = objXmlHttp.responseBody
      Dim objAdoStream
      set objAdoStream = Server.CreateObject("ADODB.Stream")
      objAdoStream.Type = 1
      objAdoStream.Open()
      objAdoStream.Write(binFileData)
      objAdoStream.SaveToFile FilePath,2
      objAdoStream.Close()
      end function
      % >

南粤风采26选5