找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 762|回复: 0
打印 上一主题 下一主题

ftp类(myftp.php)

[复制链接]

2647

主题

2647

帖子

7881

积分

论坛元老

Rank: 8Rank: 8

积分
7881
跳转到指定楼层
楼主
发表于 2018-2-14 09:46:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

                                                           
                        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(){   
        $getback = ftp_pwd($this->connector);
        return $getback;
    }
    function get_file_list($directory){   
        $getback = ftp_nlist($this->connector, $directory);
        return $getback;
    }
    function get_file($file_to_get, $mode, $mode2){
        $realfile = basename($file_to_get);
        $filename = $realfile;
        $checkdir = @$this->changedir($realfile);
        if ($checkdir == TRUE){
            ftp_cdup($this->connector);
            echo "\n[DIR] $realfile";
        }else{
            echo "..... ". $realfile ."\n";
            $getback = ftp_get($this->connector, $filename, $realfile, $mode);
            if ($mode2){
                $delstatus = ftp_delete($this->connector, $file_to_get);
                if ($delstatus == TRUE){
                    echo "File $realfile on $host deleted \n";
                }
            }
        }
        return $getback;
    }
    function mode($pasvmode){
        $result = ftp_pasv($this->connector, $pasvmode);
    }
    function ftp_bye(){
        ftp_quit($this->connector);
        return $getback;
    }
}
?>
                    
                     
            
            
您可能感兴趣的文章:
  • 用PHP实现Ftp用户的在线管理的代码
  • php实现从ftp服务器上下载文件树到本地电脑的程序
  • php下连接ftp实现文件的上传、下载、删除文件实例代码
  • php ftp文件上传函数(基础版)
  • 用PHP实现Ftp用户的在线管理
  • 无需重新编译php加入ftp扩展的解决方法
  • 深入PHP FTP类的详解
  • PHP FTP操作类代码( 上传、拷贝、移动、删除文件/创建目录)
  • PHP实现ftp上传文件示例
  • php中FTP函数ftp_connect、ftp_login与ftp_chmod用法
  • php中ftp_chdir与ftp_cdup函数用法
            
  • 分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    用户反馈
    客户端