读文本文件

代码:

<!DOCTYPE html>

<html>

<body>

<p>This is the text in the text file:</p>

<%

Set fs=Server.CreateObject("Scripting.FileSystemObject")

 

Set f=fs.OpenTextFile(Server.MapPath("testread.txt"), 1)

Response.Write(f.ReadAll)

f.Close

 

Set f=Nothing

Set fs=Nothing

%>

</body>

</html>

结果:

This is the text in the text file:

Hello! How are you today?

相关文章