(编辑:jimmy 日期: 2024/11/13 浏览:2)
<%
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")
' 创建一个 FileSystem Object 实例,并把它保存到 fileSysObj 的变量中
IF (fileSysObj.FileExists(read)) Then
Set tf = filesysobj.OpenTextFile(read, 1)
' 如果文件在,就打开读取.
read = tf.ReadLine
tf.Close
ELSE
read = "噢,找不到这个文件!"
' 如果文件不存在,发出错误提示.
END IF
%>
<html>
<body>
<p align="center">千花飞舞之读取文本内容</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>