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

纠结问题ftp下载

WBOY
WBOYOriginal
2016-06-23 13:56:10877browse

ftp下载ftp_get总报错找不到文件不知道什么原因,本地的路径不能写绝对路径么?

$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); }


回复讨论(解决方案)

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

是本地路径报错,服务器的没有问题,我放到了根目录下

我不确定在windows下本地绝对路径是否可以

有没有大神帮忙解决一下,非常感谢

Statement:
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