Filezilla通过PHP连接

Filezilla通过PHP连接,php,Php,我正试图将一个文件从我的机器(客户端)上传到我用来存储网页文件的FileZilla服务器(服务器端)。 尝试通过PHP连接到FileZilla时,我收到以下错误消息: Connection failed: Connection refused 通常,当登录凭据不正确时会出现错误,但是在本例中,它们是正确的 我的问题:你能通过PHP连接到FileZilla吗?我相信答案一定是肯定的,但是由于目前的技术困难,否则我不会感到惊讶 连接函数的格式可能存在错误 var $host = "xx.xx.xx

我正试图将一个文件从我的机器(客户端)上传到我用来存储网页文件的FileZilla服务器(服务器端)。 尝试通过PHP连接到FileZilla时,我收到以下错误消息:

Connection failed: Connection refused
通常,当登录凭据不正确时会出现错误,但是在本例中,它们是正确的

我的问题:你能通过PHP连接到FileZilla吗?我相信答案一定是肯定的,但是由于目前的技术困难,否则我不会感到惊讶

连接函数的格式可能存在错误

var $host = "xx.xx.xx.xx";
var $user = "xx";
var $pass = "xx";
var $connect;

function serverConnection()
{
    $conection = mysqli_connect($this->host, $this->user, $this->pass) or die
    ("Connection failed: " . mysqli_connect_error());
    /* check connection */
    if (mysqli_connect_errno()) {
        printf("Connect failed: %s\n", mysqli_connect_error());
        exit();
    } else {
        $this->connect = $conection;
    }
    return $this->connect;
}

目标是能够将文件从表单上传到FileZilla,作为用户配置文件图片。

目前,您正在使用连接到数据库服务器的
mysqli\u connect
,您需要连接到FTP服务器,因此您应该使用
FTP
功能。你应该先做,然后再做

它应该是这样的:

$server = 'myServer';
$user = 'myUsername';
$pass = 'myPassword';

$connect = ftp_connect($server) or die('Could not connect to FTP-server.');

if(ftp_login($connect, $user, $pass)) {
  echo 'Connected to FTP-server.';
}

目前,您正在使用连接到数据库服务器的
mysqli\u connect
,您需要连接到FTP服务器,因此您应该使用
FTP
功能。你应该先做,然后再做

它应该是这样的:

$server = 'myServer';
$user = 'myUsername';
$pass = 'myPassword';

$connect = ftp_connect($server) or die('Could not connect to FTP-server.');

if(ftp_login($connect, $user, $pass)) {
  echo 'Connected to FTP-server.';
}

为什么要使用
mysqli\u connect()
连接到FTP服务器?请尝试端口
21
…有哪些替代方案?我确实看到mysqli_connect现在是错误的-我正在将数据库连接中的代码重新用于FTP连接,您应该使用为什么要使用
mysqli_connect()
连接到FTP服务器?尝试端口
21
…有哪些替代方案?我确实看到mysqli_connect现在是错误的,尽管-我在使用数据库连接中的代码进行FTP连接,您应该使用很好的解决方案,现在它正在尝试正确连接,但是,被“die”消息提示,而不是连接。对于FileZilla,在连接之前是否有额外的步骤,例如更改设置等。登录凭据正确。解决方案很好,现在它正在尝试正确连接,但是,与连接相反,“die”消息会提示它。对于FileZilla,连接前是否有其他步骤,例如更改设置等。登录凭据是否正确