Rumah > Artikel > pembangunan bahagian belakang > 纠结有关问题ftp下载
纠结问题ftp下载
ftp下载ftp_get总报错找不到文件不知道什么原因,本地的路径不能写绝对路径么?
$remote_file = "2014-05-30_10-27-24-db.sql";<br />$local_file = "E:\\wamp\\www\\qc.sql";//(dirname(__FILE__))."/../../beifen/2014-05-29_17-11-00-db.sql";<br />//验证用户名和密码www.jb51 .net<br />$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);<br />//获取指定文件的大小<br />if ((!$conn_id) || (!$login_result)) {<br /> echo '连接到ftp服务器失败';<br /> exit;<br />} else {<br /> //print_r(ftp_chdir($conn_id,$remote_file));<br />var_dump(ftp_pwd($conn_id));<br />//$a = (dirname(__FILE__))."/../../beifen/2014-05-29_17-11-00-db.sql";<br />var_dump(ftp_chdir($conn_id,"images"));<br /> ftp_pasv ($conn_id,true); //返回一下模式,这句很奇怪,有些ftp服务器一定需要执行这句<br /> <br /> if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {<br /> echo "Successfully written to $local_file\n";<br />} else {<br /> echo "There was a problem\n";<br />}<br />//关闭FTP连接<br />ftp_close($conn_id); <br />}