你好,欢迎来到电脑编程技巧与维护杂志社! 杂志社简介广告服务读者反馈编程社区  
合订本订阅
 
 
您的位置:技术专栏 / Linux开发
ASP动态网页生成静态Html网页文件技术(2)
 

TestTemplate.asp '// 生成Html <% 
Dim fso,htmlwrite 
Dim strTitle,strContent,strOut 
'// 创建文件系统对象 
Set fso=Server.CreateObject("Scripting.FileSystemObject") 
'// 打开网页模板文件,读取模板内容 
Set htmlwrite=fso.OpenTextFile(Server.MapPath("Template.htm")) 
strOut=f.ReadAll 
htmlwrite.close 
strTitle="生成的网页标题" 
strContent="生成的网页内容" 
'// 用真实内容替换模板中的标记 
strOut=Replace(strOut,"$title$",strTitle) 
strOut=Replace(strOut,"$body$",strContent) 
'// 创建要生成的静态页 
Set htmlwrite=fso.CreateTextFile(Server.MapPath("test.htm"),true) 
'// 写入网页内容 
htmlwrite.WriteLine strOut 
htmlwrite.close 
Response.Write "生成静态页成功!" 
'// 释放文件系统对象 
set htmlwrite=Nothing 
set fso=Nothing 
%> 

(编辑:aniston)

  推荐精品文章

·2024年12月目录 
·2024年11月目录 
·2024年10月目录 
·2024年9月目录 
·2024年8月目录 
·2024年7月目录 
·2024年6月目录 
·2024年5月目录 
·2024年4月目录 
·2024年3月目录 
·2024年2月目录 
·2024年1月目录
·2023年12月目录
·2023年11月目录

  联系方式
TEL:010-82561037
Fax: 010-82561614
QQ: 100164630
Mail:gaojian@comprg.com.cn

  友情链接
 
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved
京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089