欢迎来到代码驿站!

当前位置:首页 >

如何读取文本文件的内容?

时间:2021-01-11 11:05:48|栏目:|点击:

<%
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>

上一篇:Lua协同程序函数coroutine使用实例

栏    目:

下一篇:Powershell小技巧之通过EventLog查看近期电脑开机和关机时间

本文标题:如何读取文本文件的内容?

本文地址:http://www.codeinn.net/misctech/43862.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有