文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ftp类(myftp.php)

ftp类(myftp.php)

时间:2007-02-17  来源: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;
}
}

?>
php爱好者站 http://www.phpfans.net PHP|MySQL|javascript|ajax|html.
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载