通过php连接ftp需要怎么样的配置的,我直接连接怎么链接不上呢??
<?php//setupbasicconnection$ftpserver="22.118.888.888";$conn_id=ftp_connect($ftpserve...
<?php
// set up basic connection
$ftpserver = "22.118.888.888";
$conn_id = ftp_connect($ftpserver) or die('can\'t connect to ftp');
$ftpname="123456";
$ftppass = "123456";
// login with username and password
@$login_result = ftp_login($conn_id, $ftpname, $ftppass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftpserver for user $ftpname";
exit;
} else {
echo "Connected to $ftpserver, for user $ftpname";
}
// close the FTP stream */
ftp_close($conn_id);
?> 展开
// set up basic connection
$ftpserver = "22.118.888.888";
$conn_id = ftp_connect($ftpserver) or die('can\'t connect to ftp');
$ftpname="123456";
$ftppass = "123456";
// login with username and password
@$login_result = ftp_login($conn_id, $ftpname, $ftppass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftpserver for user $ftpname";
exit;
} else {
echo "Connected to $ftpserver, for user $ftpname";
}
// close the FTP stream */
ftp_close($conn_id);
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询