ASP에서 파일을 생성하는 데 일반적으로 사용되는 두 가지 방법은 다음과 같습니다. adodb.stream을 사용하여 파일을 생성하고 스크립팅을 사용하여 파일을 생성합니다.
1. Scripting.FilesyStemObject 파일 생성 메소드 :
다음과 같이 코드를 복사하십시오. <%
setfso = createobject ( "Scripting.FilesyStemObject")
file = server.mappath ( "파일 경로 및 파일 이름을 생성하려면")
settxt = fso.opentextfile (파일, 8, true)
data1 = "파일 컨텐츠"는 Writeline 메소드를 사용하여 파일을 생성합니다
txt.writelinedata1
Data2 = "File Content" '쓰기 메소드를 사용하여 파일 생성
txt.writedData2
txt.close
txt.fso
%>
2. adodb.stream 파일 생성 메소드 :
다음과 같이 코드를 복사하십시오. <%
Dimobjadostream
setobjadoStream = server.createObject ( "adodb.stream")
objadostream.type = 1
objadostream.open ()
objadostream.write ( "파일 내용")
objadostream.savetofile 파일 경로 및 파일 이름 .htm, 2를 생성하려면
objadostream.close ()
%>