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)
。