%
Dim write
Dim fileSysObj, tf, read
read = "intels.txt"
' 讀取intels.txt.
read = LEFT(Server.Mappath(Request.ServerVariables("PATH_INFO")), InStrRev(Server.Mappath(Request.ServerVariables("PATH_INFO")), "\")) read
' 檢索要讀的文件的完整路徑.
Set fileSysObj = createObject("Scripting.FileSystemObject")
' 創(chuàng)建一個 FileSystem Object 實例,并把它保存到 fileSysObj 的變量中
IF (fileSysObj.FileExists(read)) Then
Set tf = filesysobj.OpenTextFile(read, 1)
' 如果文件在,就打開讀取.
read = tf.ReadLine
tf.Close
ELSE
read = "噢,找不到這個文件!"
' 如果文件不存在,發(fā)出錯誤提示.
END IF
%>
html>
body>
p align="center">千花飛舞之讀取文本內(nèi)容/p>
div align="center">
div align="center">
center>
table border="0" width="40%" cellspacing="0" cellpadding="0">
tr>
td width="100%" bgcolor="green">B>%=read%>/B>
/td>
/tr>
tr>
td width="100%">
/table>
/center>/div>
/body>/html>