File io 如何在ASP中打开文件
我不知道如何在ASP中打开文件。这是我不工作的代码File io 如何在ASP中打开文件,file-io,asp-classic,File Io,Asp Classic,我不知道如何在ASP中打开文件。这是我不工作的代码 <% Dim vid_file vid_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vid.dat" Dim vkey_file vkey_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vkey.dat" di
<%
Dim vid_file
vid_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vid.dat"
Dim vkey_file
vkey_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vkey.dat"
dim fp1,f
set fp1 = Server.CreateObject("Scripting.FileSystemObject")
set f=fp1.OpenTextFile(Server.MapPath("vid_file"),8,true)
f.WriteLine("This text will be added to the end of file")
f.Close
set f=Nothing
set fp1=Nothing
'Single Variable Declarations
dim fp2,f2
set fp2 = Server.CreateObject("Scripting.FileSystemObject")
'fExists=FileSysObj.FileExists(vid_file)
set f2=fp2.OpenTextFile(Server.MapPath("vkey_file"),8,true)
'set TextStreamObj = fp2.OpenTextFile(vkey_file,1,true)
'TextStreamObj.WriteLine("This text will be added to the end of file")
f2.WriteLine("This text will be added to the end of file")
f2.Close
set f2=Nothing
set fp2=Nothing
%>
您只需将此代码服务器.MapPath(“vkey\u文件”)替换为vkey\u文件,就这样。。。它会很好地工作。我已经编辑了我的答案,我已经用HTML文件进行了测试,该文件对我有效,并在test.HTML页面中写下“此文本将添加到文件末尾”。@Jinesh Jain:)好的,我有10-12行PHP代码,你能将它们转换成ASP吗?请,因为我不知道答案是肯定的,请写下我将尝试在Asp中转换这个。从1行到5行,我现在解决了这个问题,从8行到23行,我必须解决??您只需要将这个代码服务器.MapPath(“vkey_文件”)替换为vkey_文件,就这样。。。它会很好地工作。我已经编辑了我的答案,我已经用HTML文件进行了测试,该文件对我有效,并在test.HTML页面中写下“此文本将添加到文件末尾”。@Jinesh Jain:)好的,我有10-12行PHP代码,你能将它们转换成ASP吗?请,因为我不知道答案是肯定的,请写下我将尝试在Asp中转换这个。从1行到5行,我现在解决了这个问题,从8行到23行,我必须解决??它怎么不起作用?有错误信息吗?@Cheran S:)你能检查一下我是对是错吗?它怎么不起作用?有错误信息吗?@Cheran S:)你能检查一下我是对是错吗?
<%
Dim vid_file
vid_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vid.dat"
Dim vkey_file
vkey_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vkey.dat"
dim fp1,f
set fp1 = Server.CreateObject("Scripting.FileSystemObject")
set f=fp1.OpenTextFile(vid_file,8,true)
f.WriteLine("This text will be added to the end of file")
f.Close
set f=Nothing
set fp1=Nothing
'Single Variable Declarations
dim fp2,f2
set fp2 = Server.CreateObject("Scripting.FileSystemObject")
'fExists=FileSysObj.FileExists(vid_file)
set f2=fp2.OpenTextFile(vkey_file,8,true)
'set TextStreamObj = fp2.OpenTextFile(vkey_file,1,true)
'TextStreamObj.WriteLine("This text will be added to the end of file")
f2.WriteLine("This text will be added to the end of file")
f2.Close
set f2=Nothing
set fp2=Nothing
%>