ftp類(myftp.php)
更新時(shí)間:2006年10月09日 00:00:00 作者:
<?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中FTP函數(shù)ftp_connect、ftp_login與ftp_chmod用法
- PHP實(shí)現(xiàn)ftp上傳文件示例
- PHP FTP操作類代碼( 上傳、拷貝、移動(dòng)、刪除文件/創(chuàng)建目錄)
- 深入PHP FTP類的詳解
- 無需重新編譯php加入ftp擴(kuò)展的解決方法
- 用PHP實(shí)現(xiàn)Ftp用戶的在線管理
- php ftp文件上傳函數(shù)(基礎(chǔ)版)
- php下連接ftp實(shí)現(xiàn)文件的上傳、下載、刪除文件實(shí)例代碼
- php實(shí)現(xiàn)從ftp服務(wù)器上下載文件樹到本地電腦的程序
- 用PHP實(shí)現(xiàn)Ftp用戶的在線管理的代碼
- php中ftp_chdir與ftp_cdup函數(shù)用法
相關(guān)文章
php array_map()數(shù)組函數(shù)使用說明
函數(shù)array_map()函數(shù):多數(shù)組回調(diào)函數(shù)---將回調(diào)函數(shù)作用到給定數(shù)組的單元上2011-07-07