PHP写的FTP类_PHP教程

WBOY
Lepaskan: 2016-07-13 17:03:51
asal
864 orang telah melayarinya


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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/630936.htmlTechArticle?php class myftp { var $connector; var $getback; function connect($ftp_server, $uname, $passwd){ // Baut grundlegende FTP Connection auf $this-connector = @ftp_connect($ftp_server)...
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan