连接FTP服务器
bool Core_Ftp::connect( )
bool
protected function connect()
{
if (false === ($this->_conn_id = @ftp_connect($this->hostname, $this->port)))
{
if (IS_DEBUG)
{
Core::debug()->error(__('ftp unable to connect'));
}
return false;
}
if (!$this->_login())
{
if (IS_DEBUG)
{
Core::debug()->error(__('ftp unable to login'));
}
return false;
}
// 设置被动模式
if (true===$this->passive)
{
ftp_pasv($this->_conn_id, true);
}
if ($this->path)
{
$this->changedir($this->path);
}
return true;
}