©
This document uses PHP Chinese website manual Release
ReadAll 方法可读取整个 TextStream 文件,并以字符串返回结果。
注意:此方法不适合大型文件(会浪费内存资源)。
TextStreamObject.ReadAll
<%
dim fs,f,t,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt"")
f.write("Hello World!")
f.close
set t=fs.OpenTextFile("c:\test.txt"",1,false)
x=t.ReadAll
t.close
Response.Write("The text in the file is: " & x)
%>
输出:
The text in the file is: Hello World!