<?php
$local_file = "/home/zzh/Desktop/1.txt";
$server_file = "/var/www/helpdesk/1.txt";
$ftpserver = "xxx.xxx.xxx.xx";
$port = xx;
$conn_id = ftp_connect($ftpserver,$port) or die('can\'t connect to ftp');
$ftpname="xxx";
$ftppass = "xxx";
ftp_login($conn_id, $ftpname, $ftppass);
if (ftp_get($conn_id, $local_file, $server_file, FTP_ASCII)) {
echo "Successfully written to $local_file\n";
} else {
echo "There was a problem\n";
}
// close the connection
ftp_close($conn_id);
?>
我想用这个php登录ftp服务器下载1.txt来替换桌面上的1.txt,但是好像不行,我用的是ubuntu。需要帮助。
附言。我可以成功连接到ftp。