<bdo id='VJ9SK'></bdo><ul id='VJ9SK'></ul>
    <tfoot id='VJ9SK'></tfoot>

      <small id='VJ9SK'></small><noframes id='VJ9SK'>

      <i id='VJ9SK'><tr id='VJ9SK'><dt id='VJ9SK'><q id='VJ9SK'><span id='VJ9SK'><b id='VJ9SK'><form id='VJ9SK'><ins id='VJ9SK'></ins><ul id='VJ9SK'></ul><sub id='VJ9SK'></sub></form><legend id='VJ9SK'></legend><bdo id='VJ9SK'><pre id='VJ9SK'><center id='VJ9SK'></center></pre></bdo></b><th id='VJ9SK'></th></span></q></dt></tr></i><div id='VJ9SK'><tfoot id='VJ9SK'></tfoot><dl id='VJ9SK'><fieldset id='VJ9SK'></fieldset></dl></div>
      1. <legend id='VJ9SK'><style id='VJ9SK'><dir id='VJ9SK'><q id='VJ9SK'></q></dir></style></legend>

        PHP ftp_put 失败,并出现“警告:ftp_put (): PORT 命令成功"

        PHP ftp_put fails with quot;Warning: ftp_put (): PORT command successfulquot;(PHP ftp_put 失败,并出现“警告:ftp_put (): PORT 命令成功)
      2. <i id='oDi0z'><tr id='oDi0z'><dt id='oDi0z'><q id='oDi0z'><span id='oDi0z'><b id='oDi0z'><form id='oDi0z'><ins id='oDi0z'></ins><ul id='oDi0z'></ul><sub id='oDi0z'></sub></form><legend id='oDi0z'></legend><bdo id='oDi0z'><pre id='oDi0z'><center id='oDi0z'></center></pre></bdo></b><th id='oDi0z'></th></span></q></dt></tr></i><div id='oDi0z'><tfoot id='oDi0z'></tfoot><dl id='oDi0z'><fieldset id='oDi0z'></fieldset></dl></div>

          <tfoot id='oDi0z'></tfoot>
            <tbody id='oDi0z'></tbody>
            <bdo id='oDi0z'></bdo><ul id='oDi0z'></ul>
            <legend id='oDi0z'><style id='oDi0z'><dir id='oDi0z'><q id='oDi0z'></q></dir></style></legend>

                  <small id='oDi0z'></small><noframes id='oDi0z'>

                • 本文介绍了PHP ftp_put 失败,并出现“警告:ftp_put (): PORT 命令成功"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  文件是在 FTP 服务器上创建的,但它总是 0 字节大.请给我一个解决方案,以便文件上传成功.

                  File is created on the FTP server, but its always 0 bytes large. Please give me a solution so that the file upload will working success.

                  我不断收到此警告:

                  警告:ftp_put(): PORT 命令成功在 C:xampphtdocsmailing eskirim-file-simpan2.php 第 30 行
                  FTP 上传失败!

                  Warning: ftp_put (): PORT command successful in C: xampp htdocs mailing teskirim-file-simpan2.php on line 30
                  FTP upload has failed!

                  我的脚本是:

                  <?php
                  $ftp_server = "********";
                  $ftp_serverpath = "ftp.".$ftp_server;
                  $ftp_user_name = "********";
                  $ftp_user_pass = "***********";
                  $email_dir = "*******@*********";
                  
                  $nyambungkeftp = ftp_connect($ftp_server);
                  if (false === $nyambungkeftp) {
                      throw new Exception('Unable to connect');
                  }
                  
                  $loggedInnyambungkeftp = ftp_login($nyambungkeftp,  $ftp_user_name,  $ftp_user_pass);
                  if (true === $loggedInnyambungkeftp) {
                      echo 'Success!';
                  } else {
                      throw new Exception('Unable to log in');
                  }
                  
                  if ((!$nyambungkeftp) || (!$loggedInnyambungkeftp)) { 
                          echo "FTP connection has failed!";
                          echo "Attempted to connect to $ftp_server for user $ftp_user_name"; 
                          exit; 
                      } else {
                          echo "Connected to $ftp_server, for user $ftp_user_name";
                      }
                  
                  // upload the file
                  $dest = 'detectip.txt';
                  $source = 'C:xampphtdocspersuratanfile2detectip.txt';
                  
                  echo $dest;
                  echo $source;
                  $upload = ftp_put($nyambungkeftp, $dest, $source, FTP_ASCII); 
                  
                  
                  // check upload status
                  if (!$upload) { 
                          echo "FTP upload has failed!";
                      } else {
                          echo "Uploaded $source_file to $ftp_server as $destination_file";
                      }
                  
                  // close the FTP stream 
                  ftp_close($nyambungkeftp); 
                  
                  ?>
                  

                  推荐答案

                  PHP 默认为主动 FTP 模式.由于无处不在的防火墙/NAT/代理,现在主动模式几乎无法正常工作.

                  PHP defaults to the active FTP mode. The active mode hardly ever works these days due to ubiquitous firewalls/NATs/proxies.

                  您几乎总是需要使用被动模式.

                  You almost always need to use the passive mode.

                  为此调用 ftp_pasv 之后 ftp_login:

                  ftp_pasv($nyambungkeftp, true);
                  

                  请参阅关于 FTP 连接模式的我的文章,以了解,为什么您通常需要使用被动模式.

                  See my article on FTP connection modes, to understand, why you typically need to use the passive mode.

                  这篇关于PHP ftp_put 失败,并出现“警告:ftp_put (): PORT 命令成功"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      <tbody id='wePoc'></tbody>

                    <legend id='wePoc'><style id='wePoc'><dir id='wePoc'><q id='wePoc'></q></dir></style></legend>

                    • <bdo id='wePoc'></bdo><ul id='wePoc'></ul>

                          • <small id='wePoc'></small><noframes id='wePoc'>

                          • <i id='wePoc'><tr id='wePoc'><dt id='wePoc'><q id='wePoc'><span id='wePoc'><b id='wePoc'><form id='wePoc'><ins id='wePoc'></ins><ul id='wePoc'></ul><sub id='wePoc'></sub></form><legend id='wePoc'></legend><bdo id='wePoc'><pre id='wePoc'><center id='wePoc'></center></pre></bdo></b><th id='wePoc'></th></span></q></dt></tr></i><div id='wePoc'><tfoot id='wePoc'></tfoot><dl id='wePoc'><fieldset id='wePoc'></fieldset></dl></div>
                          • <tfoot id='wePoc'></tfoot>