PHP连接FTP测试

//PHP连接FTP服务器
$ftp_server = "FTP服务器的URL";
$ftp_user = "用户名";
$ftp_pass = "密码";
 
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
$login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
if ((!$conn_id) || (!$login_result)) 
{ 
  echo "FTP connection has failed!<br>";
  echo "Attempted to connect to $ftp_server for user $ftp_user<br>"; 
  exit; 
} 
else 
{
  echo "Connected to $ftp_server, for user $ftp_user<br>";
}
posted @ 2012-05-25 10:56  博尔特希  阅读(363)  评论(0编辑  收藏  举报