ftp_fget - FTP 서버에서 파일을 다운로드하고 열려있는 파일에 저장합니다. > 개발자팁

개발자팁

개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.

ftp_fget - FTP 서버에서 파일을 다운로드하고 열려있는 파일에 저장합니다. 정보

PHP ftp_fget - FTP 서버에서 파일을 다운로드하고 열려있는 파일에 저장합니다.

본문

ftp_fget - FTP 서버에서 파일을 다운로드하고 열려있는 파일에 저장합니다.

 

설명 ¶

 

bool ftp_fget ( resource $ftp_stream , resource $handle , string $remote_file , int $mode [, int $resumepos= 0 ])

ftp_fget ()는 검색remote_file FTP 서버에서 주어진 파일 포인터에 기록합니다.

 

매개 변수 ¶

 

ftp_stream

FTP 연결의 링크 식별자입니다.

 

handle

우리가 데이터를 저장하는 열린 파일 포인터.

 

remote_file

원격 파일 경로입니다.

 

mode

전송 모드. FTP_ASCII또는 중 하나 여야합니다 FTP_BINARY.

 

resumepos

원격 파일에서 다운로드를 시작할 위치입니다.

 

반환 값 ¶

 

반환 값 TRUE성공 또는 FALSE실패.

 

예 ¶

 

Example # 1 ftp_fget () 예제

 

<?php

 

// path to remote file

$remote_file = 'somefile.txt';

$local_file = 'localfile.txt';

 

// open some file to write to

$handle = fopen($local_file, 'w');

 

// set up basic connection

$conn_id = ftp_connect($ftp_server);

 

// login with username and password

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

 

// try to download $remote_file and save it to $handle

if (ftp_fget($conn_id, $handle, $remote_file, FTP_ASCII, 0)) {

 echo "successfully written to $local_file\n";

} else {

 echo "There was a problem while downloading $remote_file to $local_file\n";

}

 

// close the connection and the file handler

ftp_close($conn_id);

fclose($handle);

?>

추천
0

댓글 0개

전체 5,352
개발자팁 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT