Home > Backend Development > PHP Tutorial > 纠结有关问题ftp下载

纠结有关问题ftp下载

WBOY
Release: 2016-06-13 11:58:34
Original
1229 people have browsed it

纠结问题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 />}
Copy after login

------解决方案--------------------
首先,把文件绝对路径打印出来看下是否正确, 到ftp 服务器上去确认是否真有此文件
如果有,确认 ftp 用户是否有权限访问此文件.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template