Phpftp_connect () returns bool (true)

Source: Internet
Author: User
The Code is as follows & amp; lt ;? Php {code...} results: {code...} Why does ftp_connetc return a bool (true )? As a result, ftp_login cannot be connected to ftp. The code for normal connection is as follows:
$ftpServer = "192.168.1.118";$ftpUser = "hqzn-ftp";$ftpPwd = "123456";$conn = ftp_connect($ftpServer) || die(printf("Couldn't connect to $s", $ftpServer));var_dump($conn);$login_result = ftp_login($conn, $ftpUser, $ftpPwd);

The result is as follows:

bool(true) Warning: ftp_login() expects parameter 1 to be resource, boolean given in C:\Users\hqzn\phpStudy\WWW\EasyDarwin\html\ftp.php on line 8

Why does ftp_connetc return a bool (true )?
As a result, ftp_login cannot connect to ftp
The ftp tool can be used for normal connection.

Reply content:

The Code is as follows:

$ftpServer = "192.168.1.118";$ftpUser = "hqzn-ftp";$ftpPwd = "123456";$conn = ftp_connect($ftpServer) || die(printf("Couldn't connect to $s", $ftpServer));var_dump($conn);$login_result = ftp_login($conn, $ftpUser, $ftpPwd);

The result is as follows:

bool(true) Warning: ftp_login() expects parameter 1 to be resource, boolean given in C:\Users\hqzn\phpStudy\WWW\EasyDarwin\html\ftp.php on line 8

Why does ftp_connetc return a bool (true )?
As a result, ftp_login cannot connect to ftp
The ftp tool can be used for normal connection.

Setftp_connect($ftpServer) || die(printf("Couldn't connect to $s", $ftpServer));| Replace with or.

This is indeed the problem.
Thank you for your answers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.