佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > 怎樣讀取一個(gè)文本文件的內(nèi)容?

怎樣讀取一個(gè)文本文件的內(nèi)容?

熱門(mén)標(biāo)簽:電子圍欄 團(tuán)購(gòu)網(wǎng)站 服務(wù)器配置 Mysql連接數(shù)設(shè)置 Linux服務(wù)器 科大訊飛語(yǔ)音識(shí)別系統(tǒng) 銀行業(yè)務(wù) 阿里云
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.

標(biāo)簽:蚌埠 棗莊 萍鄉(xiāng) 衢州 江蘇 衡水 大理 廣元

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《怎樣讀取一個(gè)文本文件的內(nèi)容?》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話(huà)咨詢(xún)

    • 400-1100-266
    望江县| 老河口市| 吐鲁番市| 丹东市| 武冈市| 光泽县| 竹北市| 额敏县| 安塞县| 肥城市| 武冈市| 榆中县| 成安县| 肇源县| 全州县| 大荔县| 民和| 囊谦县| 柘城县| 兴文县| 武清区| 本溪市| 固阳县| 汽车| 东乌珠穆沁旗| 朔州市| 张北县| 乐至县| 西丰县| 贵南县| 南江县| 开鲁县| 弥渡县| 郯城县| 新民市| 万宁市| 岢岚县| 桐梓县| 那坡县| 邛崃市| 苍梧县|