当前位置:首页 > ASP教程 > 应用技巧

用ASP生成UTF-8网页文件的两种方法

方法一:createtextfile生成文件方法  
复制代码 代码如下:

<%function writetofile(filename,filecontent)  
set fso=server.createobject("scripting.filesystemobject")  
set fp=fso.createtextfile(server.mappath(filename),,true)  
fp.write(filecontent)  
end function%>  

方法二:adodb.stream生成文件方法 
复制代码 代码如下:

<%function writetofile(filename,filecontent)  
set ccobjstream = server.createobject("adodb.stream")  
with ccobjstream  
.type = 2  
.mode = 3  
.open  
.charset = "utf-8"  
.position = ccobjstream.size  
.writetext filecontent  
.savetofile filename,2  
.close  
end with  
end function%>

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!