컴

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

· 2017-02-13 (월) 01:14:52 · 2626

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

?>

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

개발자팁

5,403건

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

+
분류 제목 글쓴이 날짜 조회
PHP 17-02-11 조회 3,204
PHP 17-02-11 조회 3,337
PHP 17-02-11 조회 2,984
기타 17-02-10 조회 3,134
OS 17-02-09 조회 3,149
기타 17-02-09 조회 3,069
OS 17-02-09 조회 3,546
PHP 17-02-07 조회 3,357
PHP 17-02-07 조회 3,494
PHP 17-02-07 조회 2,917
PHP 17-02-06 조회 3,059
PHP 17-02-06 조회 2,988
PHP 17-02-06 조회 3,006
PHP 17-02-04 조회 3,293
PHP 17-02-04 조회 2,462
PHP 17-02-04 조회 2,630
PHP 17-02-03 조회 2,382
PHP 17-02-03 조회 2,798
PHP 17-02-03 조회 2,441
PHP 17-02-02 조회 2,826
PHP 17-02-02 조회 3,221
PHP 17-02-02 조회 2,924
PHP 17-01-31 조회 2,912
PHP 17-01-31 조회 3,220
PHP 17-01-31 조회 2,393
PHP 17-01-27 조회 2,547
PHP 17-01-27 조회 2,756
PHP 17-01-27 조회 2,840
PHP 17-01-26 조회 2,840
PHP 17-01-26 조회 2,780