ftp类(myftp.php)

2016-02-19 12:12 3 1 收藏

今天天气好晴朗处处好风光,好天气好开始,图老师又来和大家分享啦。下面给大家推荐ftp类(myftp.php),希望大家看完后也有个好心情,快快行动吧!

【 tulaoshi.com - Web开发 】


?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;
    }
}

?

来源:https://www.tulaoshi.com/n/20160219/1600181.html

延伸阅读
标签: Web开发
?php//// +----------------------------------------------------------------------+// | WHXBB 基类 |// +----------------------------------------------------------------------+// | Copyright (c) 2001 NetFish Software |// | ...
标签: Web开发
PHP 中的类在阐述类的概念之前我们来先说说面向对象编程的概念:面向对象的程序设计(Object-Oriented Programming,简记为OOP)立意于创建软件重用代码,具备更好地模拟现实世界环境的能力,这使它被公认为是自上而下编程的优胜者。它通过给程序中加入扩展语句,把函数“封装”进编程所必需的“对象”中。面向对象的编程语言使得复杂的工作条...
标签: PHP
  <? //【警告】:未经许可请勿随便修改 //------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------ //    // 【文件名】:        &...
标签: PHP
  下面是分页示例程序,看起来可能比较繁琐,但其实你只要用一下就会发现,"一切原来如此简单" :) example.php <?php $conn = ociplogon("test","123456","test123"); include_once "pager.inc.php"; ? <?php /** 分页测试开始 */ // {{{ 初始分页对象 $pager = new pager(); ...
标签: PHP
请打开你的编辑器,新建一个叫index.php的文件。 将以下的代码拷贝进去,保存,并且执行一下: [复制PHP代码]PHP代码如下: <? php Class  人 {                            &nbs...

经验教程

723

收藏

76
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部