推薦:ASP初學者常用源代碼總結(jié)篇(5)_ASP教程
推薦:ASP編程中15個非常有用的例子1.如何用Asp判斷你的網(wǎng)站的虛擬物理路徑 答:使用Mappath方法 以下為引用的內(nèi)容: <p align="center"><font size="4
19.使用FSO寫文件某一行的函數(shù):
function FSOlinewrite(filename,lineNum,Linecontent)
if linenum < 1 then exit function
dim fso,f,temparray,tempCnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
temparray = split(tempcnt,chr(13)&chr(10))
if lineNum>ubound(temparray) 1 then
exit function
else
temparray(lineNum-1) = lineContent
end if
tempcnt = join(temparray,chr(13)&chr(10))
set f = fso.createtextfile(server.mappath(filename),true)
f.write tempcnt
end if
f.close
set f = nothing
end function
20.使用FSO添加文件新行的函數(shù):
function FSOappline(filename,Linecontent)
dim fso,f
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),8,1)
f.write chr(13)&chr(10)&Linecontent
f.close
set f = nothing
end function
21.讀文件最后一行的函數(shù):
dim fso,f,temparray,tempcnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
set f = nothing
temparray = split(tempcnt,chr(13)&chr(10))
FSOlastline = temparray(ubound(temparray))
end if
end function
分享:asp當中判斷函數(shù)一覽最新的WEB源碼下載,馬上去看看... 商業(yè)源碼熱門下載www.chinaz.com <1>IsArray 函數(shù) 返回 Boolean 值指明某變量是否為數(shù)組。 語法 IsArray(varname) varname 參數(shù)可以是任意變量
- 相關(guān)鏈接:
- 教程說明:
ASP教程-推薦:ASP初學者常用源代碼總結(jié)篇(5)
。