php ftp_connect()返回bool(true)

WBOY
Release: 2016-06-06 20:15:56
Original
1137 people have browsed it

代码如下

<code>$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);
</code>
Copy after login
Copy after login

结果如下

<code>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
</code>
Copy after login
Copy after login

为什么ftp_connetc返回了一个bool(true)?
导致ftp_login无法连接上ftp
使用ftp工具是可以正常连接的

回复内容:

代码如下

<code>$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);
</code>
Copy after login
Copy after login

结果如下

<code>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
</code>
Copy after login
Copy after login

为什么ftp_connetc返回了一个bool(true)?
导致ftp_login无法连接上ftp
使用ftp工具是可以正常连接的

ftp_connect($ftpServer) || die(printf("Couldn't connect to $s", $ftpServer)); 中的 || 换成 or 就好了

确实是这个问题
感谢解答

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!