• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >ASP > 怎样读取一个文本文件的内容?

怎样读取一个文本文件的内容?

作者: 字体:[增加 减小] 来源:互联网 时间:2017-05-11

通过本文主要向大家介绍了c#读取文本文件内容,java读取文本文件内容,java读取文本内容,易语言读取文本内容,php读取文本内容等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
Ever want to know how to display the contents of a text document using ASP. Here is a easy way to read
from a text file

<!--Start of ASP Code---->

<%
'by James Seymour, http://jamesdot.org

Dim write
Dim fileSysObj, tf, read

' Read the read.txt

' Store the file name where the Information is stored into a variable called read

read = "read.txt"

' Retrieve the fullpath of the read file

read = LEFT(Server.Mappath(Request.ServerVariables("PATH_INFO")), InStrRev(Server.Mappath
(Request.ServerVariables("PATH_INFO")), "\")) & read

' Create an instance of FileSystem Object and store it into a variable called fileSysObj

Set fileSysObj = createObject("Scripting.FileSystemObject")

' Check whether the read file exists

IF (fileSysObj.FileExists(read)) Then
' if the file exists, then open it for reading
Set tf = filesysobj.OpenTextFile(read, 1)
read = tf.ReadLine
tf.Close
ELSE
' if you can't find read.text, display default message
read = "I can't find the file read.txt! So this is my default message."

END IF
%>


' table the displays the read.txt file
<div align="center">
<center>
<table border="0" width="40%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#EEEECC"><B><%=read%></B>
</td>
</tr>
<tr>
<td width="100%">


<!-- End of the ASP -->


use the code above, click and drag your mouse over the code to highlight it. Then right click on the
highlighted code and click "Copy." Now you may paste it into your code editor.

</div>
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 怎样读取一个文本文件的内容?

相关文章

  • 2017-05-11asp中用insert into语句向数据库插入记录(添加信息)的方法
  • 2017-05-11利用ASP规划聊天室
  • 2017-05-11asp 实现当有新信息时播放语音提示的效果
  • 2017-05-11简单过滤一下广告的代码
  • 2017-05-11创建一个ASP通用分页类
  • 2017-05-11ASP编程入门进阶(十二):ASP技巧累加(一)
  • 2017-05-11浅谈自动采集程序及入库
  • 2017-05-11asp textbox获取显示mysql数据示例代码
  • 2017-05-11asp中将相对路径转换为绝对路径的函数代码
  • 2017-05-11CheckFile函数之asp实现检查某一文件是否存在的代码

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • asp 验证用户名是否包含有非常字符的函数
    • 用ASP+FSO生成JS文件
    • 给万博系统的新闻系统增加分页功能[配有详细说明]
    • Session.TimeOut的最大取值是1440,超出会报错
    • RESPONSE.WRITE和&lt;%=%的区别
    • asp查询xml的代码 不刷新页面查询的方法
    • asp的SQL语句中and和or同时使用的注意事项
    • ASP+COM不得不注意的问题
    • SaveRemoteFile函数之asp实现保存远程的文件到本地的代码
    • 检查access数据库中是否存在某个名字的表的asp代码

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有