最新消息:阿里云双12优惠,史上最低折扣。

ASP文件系统对象FSO

服务器租用 aliyun 157浏览

在Ubuntu 17.04上通过PhpMyAdmin管理远程MySQL数据库17.10

phpMyAdmin允许您通过简单的Web浏览器管理MySQL或MariaDB数据库。在大多数环境中,phpMyAdmin软件包与数据库服务器安装在同一服务器上……因此在那里不需要太多配置……它应该可以正常工作。

FileSystemObject.OpenTextFile(fname,mode,create,format)

以下代码创建一个文本文件(c:/ test.txt),然后将一些文本写入该文件:

<%

dim fs,fname

set fs=Server.CreateObject(“Scripting.FileSystemObject”)

set fname=fs.CreateTextFile(“c:/test.txt”,true) ‘change to virtual path in shared hosting environment

fname.WriteLine(“Hello World!”)

fname.Close

set fname=nothing

set fs=nothing

%>

在共享托管环境中,将文件名从c:/ test.txt更改为您的虚拟路径;使用此代码作为文件路径,而不是server.mappath(“ / test.txt”)。

<%

Set fs=Server.CreateObject(“Scripting.FileSystemObject”)

If (fs.FileExists(server.mappath(“/test.txt”)))=true Then

Response.Write(“File exists.”)

Else

Response.Write(“File does not exist.”)

End If

set fs=nothing

%>

以下代码用于检查文件是否存在。

<%

Set fs=Server.CreateObject(“Scripting.FileSystemObject”)

Response.Write(“The file extension of the file is: “)

Response.Write(fs.GetExtensionName(server.mappath(“/test.txt”)))

set fs=nothing

%>

以下代码用于获取文件扩展名。

<%

‘ create the FSO object

set fso = Server.Createobject(“Scripting.FileSystemObject”)

path = server.mappath(“/test.txt”)

‘ open the file

set file = fso.opentextfile(path, 1) <– For reading

do until file.AtEndOfStream

Response.write(“Name: ” & file.ReadLine & ” “)

Response.write(“Home Page: ” & file.ReadLine & ” “)

Response.write(“Email: ” & file.ReadLine & “<p>”)

loop

‘ close and clean up

file.close

set file = nothing

set fso = nothing

%>

转载请注明:小猪云服务器租用推荐 » ASP文件系统对象FSO