Asp文件操作函数集(3)_ASP教程
推荐:ASP使用FCKEditor的设置技巧1、默认语言 打开fckconfig.js文件(相对FCKeditor文件夹,以下同),把自动检测语言改为不检测,把默认语言改为简体中文: 程序代码 FCKConfig.AutoDetectLanguage = false ; FCKConfig.DefaultLanguage = 'zh-cn' ; 2、字体列表 打开fckconfig.js文件,在字体列表中
Response.AddHeader "content-type","application/x-msdownload"
response.AddHeader "Content-Disposition","attachment;filename=" & filename(ubound(filename))
Response.AddHeader "content-length", fsize
Response.BinaryWrite(strchar)
Response.Flush()
End Sub
'====================================================================================================
'读取INI文件
Function ReadIni(FilePath_Name,Mysession,MyItem)
Dim MyString, MyArray,str_temp,sesstion_temp
MyString=LoadFile(FilePath_Name)
Arr=split(MyString,chr(10))
For I = 0 to UBound(Arr)
Str_temp= Arr(I)
Str_temp=Replace(Trim(Str_temp),chr(13),"")
If Trim(Str_temp)<>"" and InStr(Trim(Str_temp),";")<>1 Then
If InStr(Trim(Str_temp),"[")<InStr(Trim(Str_temp),"]") Then
sesstion_temp=Trim(Str_temp)
sesstion_temp=Replace(Trim(sesstion_temp),"[","")
sesstion_temp=Replace(Trim(sesstion_temp),"]","")
Else
MyArray = Split(Trim(Str_temp), "=")
If Trim(MyArray(0))=MyItem and sesstion_temp=MySession then
ReadIni= Trim(MyArray(1))
Exit Function
End if
End If
End if
Next
ReadIni=""
End Function
'写入INI文件
Function WriteIni(FilePath_Name,MySession,MyItem,MyValue)
Dim MyString, MyArray,str_temp,sesstion_temp,sesstion_temp2,Rstr
IsDo=false
IsHave=false
MyString=LoadFile(FilePath_Name)
Arr=split(MyString,chr(10))
For I = 0 to UBound(Arr)
Str_temp= Arr(I)
Str_temp=Replace(Trim(Str_temp),chr(13),"")
if not IsDo then
If Trim(Str_temp)<>"" and InStr(Trim(Str_temp),";")<>1 Then
If InStr(Trim(Str_temp),"[")<InStr(Trim(Str_temp),"]") Then
sesstion_temp=Trim(Str_temp)
sesstion_temp=Replace(Trim(sesstion_temp),"[","")
sesstion_temp=Replace(Trim(sesstion_temp),"]","")
if sesstion_temp<>sesstion_temp2 and IsHave then
Str_temp=MyItem&"="&MyValue&VbCrLf&Str_temp
IsDo=true
end if
sesstion_temp2=sesstion_temp
if sesstion_temp=MySession then IsHave=true
Else
MyArray = Split(Trim(Str_temp), "=")
If Trim(MyArray(0))=MyItem and sesstion_temp=MySession then
Str_temp= MyItem&"="&MyValue
IsDo=true
End if
End If
End if
End if
if(I<>UBound(Arr)) then
if Str_temp<>"" then Rstr=Rstr&Str_temp&VbCrLf
else
if Str_temp<>"" then Rstr=Rstr&Str_temp
end if
Next
if IsHave and IsDo=false then Rstr=Rstr&VbCrLf&MyItem&"="&MyValue
if IsHave=false and IsDo=false then Rstr=Rstr&VbCrLf&"["&MySession&"]"&VbCrLf&MyItem&"="&MyValue
call SaveToFile(Rstr,FilePath_Name)
End Function
'======================================================================================================
Function GetRanNum()
'****************************************
'函数名:GetRanNum
'作 用:输出带日期格式的随机数
'参 数:无 ----
'返回值:如GetRanNum(),即输出200409071553464617,为2004年09月07日15时53分46秒4617随机数
'关联函数:FormatIntNumber
'****************************************
GetRanNum = ""
GetRanNum = GetRanNum&FormatIntNumber(year(now),4)
GetRanNum = GetRanNum&FormatIntNumber(month(now),2)
GetRanNum = GetRanNum&FormatIntNumber(day(now),2)
GetRanNum = GetRanNum&FormatIntNumber(hour(now),2)
GetRanNum = GetRanNum&FormatIntNumber(minute(now),2)
GetRanNum = GetRanNum&FormatIntNumber(second(now),2)
randomize
ranNum=int((9000*rnd)+1000)
GetRanNum = GetRanNum&ranNum
End Function
Function FormatIntNumber(ExPRession,Digit)
'****************************************
'函数名:FormatIntNumber
'作 用:输出Digit位左边带0整数
'参 数:Expression ----要格式化整数
'参 数:Digit ----要格式化位数
'返回值:如0005,如FormatIntNumber(5,4),整数5被格式化为0005
'关联函数:无
'****************************************
While Len(Expression) < Digit
Expression = "0"&Expression
wend
FormatIntNumber = Expression
End Function
%>
分享:asp版域名查询的数据库接口% on error resume next PRivate d_exsit Dim Retrieval Dim Domain Dim TakenHTML Function GetURL(url) Set Retrieval = Server.CreateObject(Microsoft.xmlHTTP) With Retrieval .Open GET, url, False, , .Send GetURL = .ResponseText End With Set Retrieval = N
- 相关链接:
- 教程说明:
ASP教程-Asp文件操作函数集(3)。