读文本文件中的一个部分

代码:

<!DOCTYPE html>

<html>

<body>

<p>This is the first five characters from the text file:</p>

 

<%

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

 

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

Response.Write(f.Read(5))

f.Close

 

Set f=Nothing

Set fs=Nothing

%>

 

</body>

</html>

结果:

This is the first five characters from the text file:

Hello

相关文章