<del id="d4fwx"><form id="d4fwx"></form></del>
      <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

            <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
          • 將asp頁面轉(zhuǎn)換成htm頁面,減少資源的消耗

            2023-11-04    分類: 網(wǎng)站建設(shè)

            前段時間有個asp頁面執(zhí)行起來很慢,訪問人數(shù)又頗多,而且又不經(jīng)常修改,又懶得直接做成靜態(tài)的,每次都要從服務(wù)器下載來改,只好想辦法把asp頁面轉(zhuǎn)化成htm靜態(tài)頁面了,以增加承載的訪問人數(shù)和較少資源的消耗。此代碼適合萬網(wǎng)提供的獨立主機。
            <%
            Function Getpage(url)
            '獲得文件內(nèi)容
            dim Retrieval
            Set Retrieval = CreateObject("Microsoft.XMLHTTp")
            With Retrieval
            .Open "Get", url, False ', "", ""
            .Send
            Getpage = bytesTobstr(.Responsebody)
            End With
            Set Retrieval = Nothing
            End Function

            Function bytesTobstr(body)
            dim objstream
            set objstream = Server.CreateObject("adodb.stream")
            objstream.Type = 1
            objstream.Mode =3
            objstream.Open
            objstream.Write body
            objstream.position = 0
            objstream.Type = 2
            objstream.Charset = "Gb2312"
            bytesTobstr = objstream.ReadText
            objstream.Close
            set objstream = nothing
            End Function

            on error resume next
            Url="http://www.jbt999.com"'要讀取的頁面地址
            response.write "開始更新首頁..."
            wstr = Getpage(Url)

            'response.write(wstr)
            Set fs=Server.CreateObject("Scripting.FileSystemObject")

            'if not MyFile.FolderExists(server.Mappath("/html/")) then
            'MyFile.CreateFolder(server.Mappath("/html/"))'
            'end if

            '要存放的頁面地址
            dizhi=server.Mappath("index.htm")
            If (fs.FileExists(dizhi)) Then
            fs.DeleteFile(dizhi)
            End If

            Set CrFi=fs.CreateTextFile(dizhi)
            Crfi.Writeline(wstr)
            set CrFi=nothing
            set fs=nothing
            response.write "...<font color=red>更新完成!</font>"
            %>
            代碼算是最簡單的,直接保存成一個asp文件即可,只要把URL(要轉(zhuǎn)化的asp地址)和地址(要保存的html地址)設(shè)置好就可以了,一般這兩個文件在同一個目錄,才能保證圖片或者css、js起作用。

            當(dāng)前標(biāo)題:將asp頁面轉(zhuǎn)換成htm頁面,減少資源的消耗
            文章網(wǎng)址:http://www.jbt999.com/news21/292421.html

            成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動網(wǎng)站建設(shè)企業(yè)網(wǎng)站制作、虛擬主機網(wǎng)頁設(shè)計公司、網(wǎng)站制作App設(shè)計

            廣告

            聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

            成都網(wǎng)站建設(shè)

              <del id="d4fwx"><form id="d4fwx"></form></del>
              <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

                    <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
                  • 99热国产在线观看 | 91人妻人人澡人人精品 | 久久免费毛片 | 狼友大香蕉 | 高清无码一线逼美女系列 |