skymvc/library/cls_ftp.php

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。


<?php
	
class ftp 
{ 
  public $result;               
  public $conn_id;          
   
  /** 
  * 方法:FTP连接 
  * @FTP_HOST -- FTP主机 
  * @FTP_PORT -- 端口 
  * @FTP_USER -- 用户名 
  * @FTP_PASS -- 密码 
  */
  function __construct($FTP_HOST,$FTP_PORT,$FTP_USER,$FTP_PASS) 
  { 
    $this->conn_id = @ftp_connect($FTP_HOST,$FTP_PORT) or die("FTP服务器连接失败"); 
    @ftp_login($this->conn_id,$FTP_USER,$FTP_PASS) or die("FTP服务器登陆失败"); 
    @ftp_pasv($this->conn_id,1); // 打开被动模拟 
  } 
  
  function chmod($mod,$file){
  	if(ftp_chmod($this->conn_id,$mod,$file)!==false){
  		return true;
  	}
  	return false;
  }
  
  function down_dir($from,$to,$mod="666"){
  	$files = ftp_rawlist($this->conn_id, $from,true);
  	if(empty($files)) return false; 
  	foreach($files as $f){
  		$type=substr($f,0,1);
  		 
  		if(trim($type)=="d"){
  			$file=str_replace(substr($f,0,strrpos($f," ")+1),"",$f);
  			$this->down_dir($from."/".$file,$to,$mod);
  		}else{
  			$file=str_replace(substr($f,0,strrpos($f," ")+1),"",$f);
  			$this->down_file($from."/".$file,$to.$from."/".$file,$mod);
  		}
  		 
  	}
  	return true;
	
  }
  
  function down_file($from,$to,$mod="666"){
  	$dir=dirname($to); 	 
  	if($dir!="." && !file_exists($dir)){
  		mkdir($dir,$mod,true);  		
  	}
  	$fp=fopen($to,"w");
  	if (ftp_fget($this->conn_id, $fp, $from, FTP_ASCII, 0)) {
  		return true;
  	}
  	return false;
  	fclose($fp);
  }
后面还有 81 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。