国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

怎樣讀取一個文本文件的內容?

2019-11-18 21:16:09
字體:
來源:轉載
供稿:網友
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("Scr
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.


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大悟县| 平阴县| 绿春县| 观塘区| 丹阳市| 启东市| 郎溪县| 丰台区| 东城区| 五华县| 中山市| 金堂县| 定日县| 青川县| 延津县| 文成县| 富阳市| 偏关县| 万宁市| 北票市| 平塘县| 九台市| 监利县| 浪卡子县| 大庆市| 丹寨县| 五寨县| 手游| 辽源市| 凤山市| 陈巴尔虎旗| 轮台县| 定兴县| 阳原县| 宜州市| 磐安县| 临潭县| 汾西县| 朝阳市| 惠东县| 易门县|