我是靠谱客的博主 无奈白昼,最近开发中收集的这篇文章主要介绍ftp类(myftp.php),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述


<?php

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(){    
        $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;
    }
}

?>

最后

以上就是无奈白昼为你收集整理的ftp类(myftp.php)的全部内容,希望文章能够帮你解决ftp类(myftp.php)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(111)

评论列表共有 0 条评论

立即
投稿
返回
顶部