对于网站做到一定程度的站长而言,如何将asp文件生成为htm文件是一件非常头疼的问题,因为如是asp页面过多,则服务器访问速度会越来越慢,所有将asp生成为htm文件是早晚的事,那又如何将asp文件生成为htm文件呢?生成方法很简单。
ASP生成htm静态页面基本代码
<%
filename="test.htm"
if request("body")<>"" then
set fso = Server.CreateObject("Scripting.FileSystemObject")
set fout = fso.CreateTextFile(server.mappath(""&filename&""))
fout.write "标题(title):" & request.form("title") & "<br>"
fout.write "内容(body):" & request.form("body")
fout.close
set fout=nothing
set fso=nothing
end if
%>
<form name="form1" method="post" action="">
<input name="title" size=18><br>
<textarea name="body" rows="1" cols="20"></textarea>
<br>
<br>
<input type="submit" name="Submit" value="生成">
</form>