下载首页 | 资讯中心 | 下载分类 | 最近更新 | 排 行 榜 | 国产软件 | 国外软件 | 汉化补丁 | | |
文章搜索: 分类 关键字 -----→木蚂蚁推荐 [激情视频网]
您的位置:首页网站技术 → 动态网站首页的静态生成方法
动态网站首页的静态生成方法
日期:2006-6-3 16:58:00 人气:     [ ]
方法一

<%

'常用函数
'1、输入url目标网页地址,返回值getHTTPPage是目标网页的html代码
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.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

'2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换
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



txtURL=server.MapPath("../index.asp")

sText = getHTTPPage(txtURL)

Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
filename="../index.htm"
Set openFile=FileObject.OpenTextfile(server.mapPath(filename),2,true) 'true为不存在自行建立
openFile.writeline(sText)
Set OpenFile=nothing

%>
<script>
alert("静态网页生成完毕");
history.back();
</script>

方法二:

resourcefile=server.MapPath("../index.asp")
targetfile=server.MapPath("../index.htm")
Set html = Server.CreateObject("CDO.Message")
html.CreateMHTMLBody resourcefile,31
indexcode=html.HTMLBody
Set html = Nothing
if instr(indexcode,"</BODY></HTML>")<=0 then
response.Write("首页生成失败")
response.End()
else
Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")
Set outfile=oFileSys.CreateTextFile(targetfile)
outfile.WriteLine indexcode
outfile.close
Set outfile=nothing
set oFileSys=nothing
response.Write("首页生成完毕!")
end if



出处:mumayi.net 作者:不详
评论人 评论内容摘要(共 36 条,查看完整内容) 得分 60 发表时间
36 [回复]
GOOGLE左侧排名 我网站GOOGLE排名一直很不错,但昨天GOOGLE左侧排名突然掉下来了,谁知道 09-02 18:12
35 [回复]
GOOGLE左侧排名 我网站GOOGLE排名一直很不错,但昨天GOOGLE左侧排名突然掉下来了,谁知道 09-02 10:20
34 [回复]
GOOGLE左侧排名 我网站GOOGLE排名一直很不错,但昨天GOOGLE左侧排名突然掉下来了,谁知道 09-02 01:36
33 [回复]
GOOGLE左侧排名 我网站GOOGLE排名一直很不错,但昨天GOOGLE左侧排名突然掉下来了,谁知道 08-13 05:59
32 [回复]
GOOGLE左侧排名 我网站GOOGLE排名一直很不错,但昨天GOOGLE左侧排名突然掉下来了,谁知道 08-12 15:41
31 [回复]
GOOGLE左侧排名 我网站GOOGLE排名一直很不错,但昨天GOOGLE左侧排名突然掉下来了,谁知道 08-05 07:17
30 [回复]
GOOGLE左侧排名 我网站GOOGLE排名一直很不错,但昨天GOOGLE左侧排名突然掉下来了,谁知道 08-02 01:48
 热点文章
·2005年最新注册机大全[中国破解联盟木蚂蚁社区收..
·超星阅读器破解大全
·自己利用PHOTOSHOP制作1寸或2寸照片
·ACDSee7.0 汉化破解版的正确安装方法
·EvID4226Patch(破解SP2的链接数)
·破解收费影视网站的影片下载地址
·精彩屏保--有你喜欢的[N种][转][精]
·激活灵感:Adobe Photoshop CS2抢先体验
·流光5.0使用小窍门
·网络尖兵破解方法
 推荐文章
·EvID4226Patch(破解SP2的链接数)
·网络尖兵破解方法
·几个比较好的网站分享
·打造运行在U盘上的超迷你Win 98系统
·不看后悔!一种好用的RM、RMVB转换工具 Easy Rea..
·提升Windows XP启动速度(微软内部提供)(附图片..
·用JQQTOOLS申请9无号码和晒号简单教程
·这样的"绿色软件"不能用
·联想内部维修资料
·搜索引擎老大Google出饮料了 还是beta版(多图)
木蚂蚁网络 版权所有 Copyright© 2001-2005 Www.MuMaYi.Net, All Rights Reserved. Powered By 木蚂蚁社区