Home  >  Article  >  Backend Development  >  PHP imitates ftp file upload example_PHP tutorial

PHP imitates ftp file upload example_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:06:521038browse

$mymode   = FTP_ASCII;
$delete   = 0;
$local_dir   = "/my_local_download_directory";
$host    = "ftp.yahoo.de";
$remote_dir   = ".";
$anonymous  = 0;
$user    = "myusername";

核心代码

class myftp {

 var $connector;
 var $getback;
 
 function connect($ftp_server, $uname, $passwd){
 // Baut grundlegende FTP Connection auf
  $this->connector = @ftp_connect($ftp_server);
  $this->login_result = @ftp_login($this->connector, "$uname", "$passwd");
  if ((!$this->connector) || (!$this->login_result))
  {
          echo "FTP connection has failed! n";
          echo "Attempted to connect to $ftp_server for user $uname n";
          die;
      } else {
          echo "Connected to $ftp_server, for user $uname n";
      }
 }

 function lastmodtime($value){
  $getback = ftp_mdtm ($this->connector,$value);
  return $getback;
 }

 function changedir($targetdir){
  $getback = ftp_chdir($this->connector, $targetdir);
  return $getback;
 }
 function getdir(){
 // Liefert Directory Namen zur

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445006.htmlTechArticle$mymode= FTP_ASCII; $delete= 0; $local_dir = /my_local_download_directory; $host = ftp.yahoo.de; $remote_dir = .; $anonymous= 0; $user = myusername; 核心代码 class myftp { var...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn