猿问

你好,我该怎么把ASP转成HTML?需要怎么操作?

我想把ASP转换成HTML格式的页面,不知道怎么办?

凤凰求蛊
浏览 274回答 2
2回答

陪伴而非守候

利用模板技术把asp转换成html<%sub asp2htm()'定义Recordset对象Set rs=Server.CreateObject("ADODB.Recordset")'设置rs的ActiveConnection属性,绑定到连接Set rs.ActiveConnection = Conn'设置游标类型rs.CursorType = 3sql="select * from article where title='"&title&"'"rs.open sqldo while not rs.eofArticleID=rs("ArticleID")title=rs("title")author=rs("Author")copyfrom=rs("copyfrom")hits=rs("hits")updatetime=rs("updatetime")editor=rs("editor")content=rs("content")Key=rs("key")content = replace(content,"../UploadFiles/","../../UploadFiles/") '解决图片路径问题'title = Request("title") '获取标题'content = Request("content") '获取内容'path = Server.MapPath("html") '保存路径tnow = now()fname = year(tnow)&FormatNumber(month(tnow)/100,2,Flase)&FormatNumber(day(tnow)/100,2,Flase)&FormatDateTime(tnow,3)&ArticleIDfname = replace(fname,".","")fname = replace(fname,":","")fname = fname & ".htm" '生成HTML文件的文件名Set fso = CreateObject("Scripting.FileSystemObject")Set ftemp = fso.OpenTextFile(Server.MapPath("asp2htm/templates.txt"), 1)TempData = ftemp.ReadAll '读取模板内容ftemp.CloseTempData = Replace(TempData,"#title#",title) '写入标题TempData = Replace(TempData,"#content#",content) '写入内容TempData = Replace(TempData,"happig",author)TempData = Replace(TempData,"本站原创",copyfrom)'TempData = Replace(TempData,"#click#",hits)TempData = Replace(TempData,"2006-11-9 15:56:13",updatetime)TempData = Replace(TempData,"admin",editor)TempData = Replace(TempData,"7744",articleid)TempData = Replace(TempData,"|asp,自动生成,html,优化|",Key)TempData = Replace(TempData,"7744",ArticleID)Set fhtml = fso.CreateTextFile(path&"\"&fname)fhtml.WriteLine TempData '保存文件fhtml.CloseSet fso = nothingsql="update Article set content='"&fname&"' where articleid="&cint(articleid)cmd(sql)rs.movenextresponse.Write("添加"&title&"成功<br>")response.Clear()Response.Flush()loopcall cdb(rs)'将信息存入数据库略。end sub%>
随时随地看视频慕课网APP

相关分类

Java
Html5
我要回答