选择语言 :

 Core_Ftp::download

从FTP上下载一个文件

bool Core_Ftp::download( string $rempath , string $locpath [, string $mode = string(4) "auto" ] )

参数列表

参数 类型 描述 默认值
$rempath string
$locpath string
$mode string string(4) "auto"
返回值
  • bool
File: ./core/classes/ftp.class.php
public function download($rempath, $locpath, $mode = 'auto')
{
	if (!$this->_is_conn())
	{
		return false;
	}

	// 设置权限
	if ($mode === 'auto')
	{
		// 获取类型
		$ext  = $this->_getext($rempath);
		$mode = $this->_settype($ext);
	}

	$mode = ($mode === 'ascii') ? FTP_ASCII : FTP_BINARY;

	$result = @ftp_get($this->_conn_id, $locpath, $rempath, $mode);

	if ($result === false)
	{
		if (IS_DEBUG)
		{
			Core::debug()->error(__('ftp unable to download'));
		}
		return false;
	}

	return true;
}