SMS처리 도우미
이름 FTP Class
카테고리 codeigniter     >     FTP Class
예제(문법)

FTP Class를 통한 작업
     클래스 초기화
          CodeIgniter의 다른 클래스처럼 FTP Class는 컨트롤러에서 "$this->load->library" 함수로 초기화합니다.

          $this->load->library('ftp');

          한번 로드된 이후, FTP 객체는 "$this->ftp"로 사용가능합니다.

     사용법 예제
          이 예에서, FTP 서버 Connection을 열고, 로컬 파일을 읽은 후 ASCII 모드로 전송합니다.
          파일 퍼미션은 755로 세팅됩니다.

          $this->load->library('ftp');

          $config['hostname'] = 'ftp.example.com';
          $config['username'] = 'your-username';
          $config['password'] = 'your-password';
          $config['debug']        = TRUE;

          $this->ftp->connect($config);

          $this->ftp->upload('/local/path/to/myfile.html', '/public_html/myfile.html', 'ascii', 0775);

          $this->ftp->close();

          이 예에서, 서버로부터 파일 목록을 가져옵니다.

          $this->load->library('ftp');

          $config['hostname'] = 'ftp.example.com';
          $config['username'] = 'your-username';
          $config['password'] = 'your-password';
          $config['debug']        = TRUE;

          $this->ftp->connect($config);

          $list = $this->ftp->list_files('/public_html/');

          print_r($list);

          $this->ftp->close();

          이 예에서, 로컬 디렉토리를 서버와 미러링시킵니다.

          $this->load->library('ftp');

          $config['hostname'] = 'ftp.example.com';
          $config['username'] = 'your-username';
          $config['password'] = 'your-password';
          $config['debug']        = TRUE;

          $this->ftp->connect($config);

          $this->ftp->mirror('/path/to/myfolder/', '/public_html/myfolder/');

          $this->ftp->close();

변수
-
설명

 CodeIgniter FTP Class는 특정 파일을 원격 서버로 전송하도록 도와줍니다.
 또한 원격 파일을 이동하거나 파일명 변경하고, 삭제할 수 있습니다.
 FTP Class는 미러링 함수를 지원하는데, 로컬 디렉토리 전체를 (FTP를 통해) 원격으로 전송하도록 도와줍니다.

 주의사항
      SFTP 및 SSL FTP 프로토콜은 지원하지 않으며, 오직 표준 FTP만 지원합니다.

X
로그기록