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);

?>

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

개발자팁

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

+
분류 제목 글쓴이 날짜 조회
PHP 8년 전 조회 2,340
PHP 8년 전 조회 2,129
PHP 8년 전 조회 2,537
PHP 8년 전 조회 2,142
jQuery 8년 전 조회 2,983
jQuery 8년 전 조회 3,006
jQuery 8년 전 조회 1,991
jQuery 8년 전 조회 2,652
jQuery 8년 전 조회 2,937
jQuery 8년 전 조회 3,266
PHP 8년 전 조회 2,415
PHP 8년 전 조회 3,930
PHP 8년 전 조회 2,196
PHP 8년 전 조회 2,703
PHP 8년 전 조회 2,179
PHP 8년 전 조회 2,484
PHP 8년 전 조회 2,741
PHP 8년 전 조회 2,828
PHP 8년 전 조회 2,525
기타 8년 전 조회 2,681
OS 8년 전 조회 2,688
기타 8년 전 조회 2,610
OS 8년 전 조회 3,121
PHP 8년 전 조회 2,873
PHP 8년 전 조회 3,035
PHP 8년 전 조회 2,499
PHP 8년 전 조회 2,585
PHP 8년 전 조회 2,515
PHP 8년 전 조회 2,496
PHP 8년 전 조회 2,812
🐛 버그신고