时间:2021-07-01 10:21:17 帮助过:8人阅读
$remote_file = "2014-05-30_10-27-24-db.sql";
$local_file = "E:\\wamp\\www\\qc.sql";//(dirname(__FILE__))."/../../beifen/2014-05-29_17-11-00-db.sql";
//验证用户名和密码www.jb51 .net
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//获取指定文件的大小
if ((!$conn_id) || (!$login_result)) {
echo '连接到ftp服务器失败';
exit;
} else {
//print_r(ftp_chdir($conn_id,$remote_file));
var_dump(ftp_pwd($conn_id));
//$a = (dirname(__FILE__))."/../../beifen/2014-05-29_17-11-00-db.sql";
var_dump(ftp_chdir($conn_id,"images"));
ftp_pasv ($conn_id,true); //返回一下模式,这句很奇怪,有些ftp服务器一定需要执行这句
if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {
echo "Successfully written to $local_file\n";
} else {
echo "There was a problem\n";
}
//关闭FTP连接
ftp_close($conn_id);
}