makehtml.asp
来自「这次自已做的美工,可能很难看,但主要是为提高效率,这次全部生成了静态,只有一个链」· ASP 代码 · 共 45 行
ASP
45 行
<%
'以下的函数为XMLHTTP捉取远程数据显示出来的东西,呵,也就是用来生成HTML的
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
End function
Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
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
%>
<%
sub makehtml(uname,fname)
mydsn=""
'mydsn为模板文件所在的路径
url=mydsn & uname
body=getHTTPPage(url)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(fname),true)
fout.writeline body
fout.close
end sub
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?