存档

‘asp’ 分类的存档

ASP中文件的写入最简单代码

2009年4月19日

set fso = Server.CreateObject(“Scripting.FileSystemObject”) ‘fso对象
set htmlwrite = fso.CreateTextFile(server.mappath(“text.txt”))
htmlwrite.write “这是写入的内容”
htmlwrite.close
set fso=nothing

admin asp ,

ASP读取文件流的自定义方法

2009年4月19日

Function fso_file_open(fso_file_open_name)
on error resume next
if fso_file_open_name<>“” then
Set lq_fso=Server.Createobject(“Scripting.FilesystemObject”)
if lq_fso.FileExists(“”&Server.MapPath(“”&fso_file_open_name&”")&”") then
Set lq_read = lq_fso.OpenTextFile(“”&Server.MapPath(“”&fso_file_open_name&”")&”",1,True)
fso_file_open=lq_read.ReadAll
lq_read.Close
else
fso_file_open=”"
end if
Set lq_fso=Nothing
else
fso_file_open=”"
end if
End Function

admin asp

jmail的组件在ASP中应用

2009年4月19日

<%
dim body
body="test” ‘定义邮件内容
Set msg = Server.CreateObject(“JMail.Message”)
msg.ContentType = “text/html” ‘定义邮件格式为文本还是超文本
msg.Priority = 1 ‘优先级
msg.silent = true
msg.Logging = true
msg.Charset = “gb2312″ ‘编码
msg.MailServerUserName = “test@7dit.com” ‘输入smtp服务器验证登陆名 (邮局中任何一个用户的Email地址)
msg.MailServerPassword = “test” ‘输入smtp服务器验证密码 (用户Email帐号对应的密码)
msg.From = “test@7dit.com” ‘发件人Email
msg.FromName = “奇点” ‘发件人姓名
msg.AddRecipient “rec@7dit.com” ‘收件人Email
msg.Subject = “test” ‘信件主题
msg.Body = body
msg.Send (“mail.test.com”) ‘smtp服务器地址(企业邮局地址)
set msg = nothing
%>

admin asp ,

ASP实用的两个正则函数

2009年4月19日

< %

function shownew(str,patrn,strRepl)
Dim regEx
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = patrn
shownew = regEx.Replace(str, strRepl)
end function
Response.write shownew("12345sdf32","(\d+)","$1″)
‘ 函数用于替换指定的字符串
%>

阅读全文…

admin asp ,