简体   繁体   English

警告:ftp_get():RETR

[英]Warning: ftp_get(): RETR

I am using this code: 我正在使用此代码:

   <?php
// connect and login to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);

$local_file = "local.zip";
$server_file = "server.zip";

// download server file
if (ftp_get($ftp_conn, $local_file, $server_file, FTP_ASCII))
  {
  echo "Successfully written to $local_file.";
  }
else
  {
  echo "Error downloading $server_file.";
  }

// close connection
ftp_close($ftp_conn);
?>

In order to get a specific file from a server. 为了从服务器获取特定文件。 I tried also using - 我也尝试使用-

if (ftp_get($ftp_conn, $local_file, $server_file, FTP_BINARY))

insted of 装的

if (ftp_get($ftp_conn, $local_file, $server_file, FTP_ASCII))

I kepp getting the error- Warning: ftp_get(): RETR in myfile.php on line 13. 我无法获取错误-警告:第13行上的myfile.php中的ftp_get():RETR。

Please Help. 请帮忙。

Shimon, when you send and ftp_get , you're sending an RETR command to the ftp server requesting the desired file. Shimon,当您发送和ftp_get ,您正在将RETR命令发送到ftp服务器,以请求所需的文件。 It seems that RETR is disabled on your FTP server. 看来您的FTP服务器上的RETR已禁用。 Try to get your file with your favorite FTP client to see if will work an tell us the result here. 尝试使用您喜欢的FTP客户端获取文件,看看是否可以正常工作,并在此处告诉我们结果。 (Also, check if you have read permissions on that folder) (此外,检查您是否对该文件夹具有读取权限)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM