将本地路径目录文件上传同步到FTP指定目录
bool Core_Ftp::mirror( string $locpath , string $rempath )
参数列表
参数 类型 描述 默认值 $locpath
string
本地完整路径 $rempath
string
远程路径
bool
public function mirror($locpath, $rempath)
{
if (!$this->_is_conn())
{
return false;
}
if (true==($fp = @opendir($locpath)))
{
if (!$this->changedir($rempath, true) && (!$this->mkdir($rempath) || !$this->changedir($rempath)))
{
return false;
}
while (false !== ($file = readdir($fp)))
{
if (@is_dir($locpath.$file) && $file[0] !== '.')
{
$this->mirror($locpath.$file.'/', $rempath.$file.'/');
}
elseif ($file[0] !== '.')
{
$ext = $this->_getext($file);
$mode = $this->_settype($ext);
$this->upload($locpath.$file, $rempath.$file, $mode);
}
}
return true;
}
return false;
}