久久伊人在_九九av在线_美日毛片_深夜福利在线视频_日本三级精品_天天躁日日躁狠狠躁av麻豆男男

湖南長沙八年做網站,網絡優化推廣服務團隊,讓您小投資大回報,幫您打開網絡營銷財富之門!
 業務服務熱線:0731-88571521  13637482004  
 


地址:長沙市韶山南路248號南園503
      室(瀟湘晨報旁)
電話:0731-88571521
手機:13637482004
Q  Q:44377655 522392221
網址:m.0688888.cn
郵箱:522392221@qq.com
做網站解決方案
長沙做網站聯系電話:0731-88571521 13637482004

asp定時生成靜態HTML的代碼

信息來源:斌網網絡   發布時間:2010-6-15   瀏覽:
復制代碼 代碼如下:
<% 
’判斷是否要生成新的HTML 
if Application("cache_asptohtml_date")="" then 
Application.Lock 
Application("cache_asptohtml_date")=now() 
Application.Unlock 
Call aspTohtml 
Response.Redirect("index.html") 
end if 
if DateDiff("s", Application("cache_asptohtml_date"),Now)> 100 then ’比較上次更新時間與當前時間相差多少秒 
Application.Lock 
Application("cache_asptohtml_date")=now() 
Application.UnLock 
Call aspTohtml 
Response.Redirect("index.html") 
Else 
Response.Redirect("index.html") 
End if 

’獲取當前目錄! 
function getpath 
if Request.ServerVariables("SERVER_PORT")<>"80" then 
UserUrl = "http://"&Request.ServerVariables("SERVER_NAME")& ":" & Request.ServerVariables("SERVER_PORT")& Request.ServerVariables("URL") 
else 
UserUrl = "http://"&Request.ServerVariables("SERVER_NAME")& Request.ServerVariables("URL") 
end if 
getpath=left(UserUrl,InstrRev(UserUrl,"/")) 
end function 

sub aspTohtml 
’---------------------------------------------------------- 
’使用XMLHTTP生成靜態首頁的代碼 
’Curl 為你的首頁地址,確保你的空間支持FSO 
’----------------------------------------------------------- 
dim read,Curl,content 
Curl=getpath&"home.asp" 
read=getHTTPPage(Curl) 
if read<>"" then 
content=read 
Set Fso = Server.CreateObject("Scripting.FileSystemObject") 
Filen=Server.MapPath("index.html") 
Set Site_Config=FSO.CreateTextFile(Filen,true, False) 
Site_Config.Write content 
Site_Config.Close 
Set Fso = Nothing 
end if 
End sub 
Function getHTTPPage(url) 
dim http 
set http=Server.createobject("Microsoft.XMLHTTP") 
Http.open "GET",url,false 
Http.send() 
if Http.readystate<>4 then 
exit function 
end if 
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312") 
set http=nothing 
if err.number<>0 then err.Clear 
End Function 

Function BytesToBstr(body,Cset) 
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 = Cset 
BytesToBstr = objstream.ReadText 
objstream.Close 
set objstream = nothing 
End Function 
%> 

ASP定時生成靜態頁(HTML)2 
復制代碼 代碼如下:
<% 
set fs=server.createobject("scripting.filesystemobject") 
file=server.mappath("time.txt") 
set txt=fs.opentextfile(file,1,true) 
if not txt.atendofstream then 
times=txt.ReadLine 
Else 
response.write "<br /><!--有沒有發現time.txt 開始生成!-->" 
HtmlPage = "time.txt" ’//生成的HTML文件名 
Template = NOW() 
Set FSO = Server.CreateObject ("Scripting.FileSystemObject") 
Set FileOut = FSO.CreateTextFile(Server.MapPath (HtmlPage)) 
FileOut.WriteLine Template 
FileOut.Close 
Set FSO = Nothing 
end If 


If datediff("s",times,NOW()) > 3600 Then ’//上次更新到現在的時間 大于 3600秒 則 更新 
response.write "<br /><!--時間過了開始更新-->" 

code = "這里是需要生成的html代碼" ’//如何得到代碼的方式有很多 

’//用FSO生成HTML頁面 
HtmlPage = "index.html" ’//生成的HTML文件名 
Template = code 
Set FSO = Server.CreateObject ("Scripting.FileSystemObject") 
Set FileOut = FSO.CreateTextFile(Server.MapPath (HtmlPage)) 
FileOut.WriteLine Template 
FileOut.Close 
Set FSO = Nothing 

’//用FSO生成time.txt文件 
HtmlPage = "time.txt" ’//生成的HTML文件名 
Template = NOW() 
Set FSO = Server.CreateObject ("Scripting.FileSystemObject") 
Set FileOut = FSO.CreateTextFile(Server.MapPath (HtmlPage)) 
FileOut.WriteLine Template 
FileOut.Close 
Set FSO = Nothing 

Else 

response.write "<br /><!-- 已經過去"&datediff("s",times,NOW())&"秒!-->" 

End If 
%> 

詳細出處參考:http://www.jb51/article/23955.htm

相關熱點文章


地址:湖南長沙市韶山南路248號南園503室(瀟湘晨報旁)  版權所有:長沙市天心區斌網網絡技術服務部
咨詢電話:0731-88571521   13637482004
業務 QQ:客服一 1306053142 客服二 1320506001 技術/售后 522392221 高級顧問 44377655
服務郵箱:fanbin@binweb.cn   522392221@qq.com
官方網址:www.binweb.cn   m.0688888.cn
旗下網站:斌網網絡  長沙信息處  佛佛網  曬土貨網
 湘公網安備 43010302000270號  網站ICP備案號:湘ICP備13006070號-1  

在線客服1 在線客服2 技術咨詢 資深顧問

主站蜘蛛池模板: 日韩一区精品 | 久久国产精品免费视频 | 精品国产一区在线观看 | 成人免费视频视频 | 99精品久久久久久 | 国产高清免费 | 男人天堂2021 | 蜜臀久久99精品久久久久久 | 成人一区二区视频 | 黄色av网站在线 | 天天舔天天射 | 成人毛片100免费观看 | 日韩在线视频看看 | 日韩二区在线 | 久久亚洲成人 | 美女特级毛片 | 少妇久久久久久久 | 国产99精品 | 国产一区二区不卡 | 亚洲资源在线观看 | 亚洲天堂三级 | 亚洲香蕉中文网 | 日韩一区二区三区免费视频 | 国产乱码精品一区二三区蜜臂 | 91福利片| 日产精品久久久久 | av资源在线看 | 男女拍拍视频 | 日韩欧美大片在线观看 | 91精品一区二区三区蜜桃 | www.狠狠操| 人人插人人澡 | 日本欧美一区 | 精品社区| 这里有精品视频 | 欧美亚洲二区 | 五月天社区 | 久久精品一区二区 | 亚洲色图偷 | 精品日本一区二区三区在线观看 | 欧美精品另类 |