php ftp_connect()返回bool(true)
ringa_lee
ringa_lee 2017-04-10 16:58:14
0
2
610

代码如下
<?php

$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);

结果如下

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

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

ringa_lee
ringa_lee

ringa_lee

全員に返信(2)
洪涛

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

いいねを押す +0
Ty80

确实是这个问题
感谢解答

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!