function download($remote_path, $file, $replace = true, $mode = 'auto') { if ($this->is_connected && !empty($remote_path)) { if ($mode == 'auto') { $mode = $this->_settype(Util_Tools::getFileExtension($remote_path)); } $mode = $mode == 'ascii' ? FTP_ASCII : FTP_BINARY; if (file_exists($file) && $replace) { unlink($file); } if (@ftp_get($this->conn, $file, $remote_path, $mode)) { return true; } else { if ($this->debug) { die(Util_Tools::displayError('FTP获取文件失败:' . $remote_path . ':' . $file)); } } } else { if ($this->debug) { die(Util_Tools::displayError('FTP未连接或目录为空:' . $remote_path)); } } return false; }