请教Warning: ftp_put() [function.ftp-put]: Opening BINARY mode data connection

WBOY
Release: 2016-06-13 10:21:46
Original
2019 people have browsed it

请问Warning: ftp_put() [function.ftp-put]: Opening BINARY mode data connection
请问题目的错误提示,是什么原因导致的呢?

------解决方案--------------------
这是PHP手册里的范例 也是你的答案

Here's a quick function that figures out the correct mode to use based on a file's extension.

function get_ftp_mode($file)
{
$path_parts = pathinfo($file);
 
if (!isset($path_parts['extension'])) return FTP_BINARY;
switch (strtolower($path_parts['extension'])) {
case 'am':case 'asp':case 'bat':case 'c':case 'cfm':case 'cgi':case 'conf':
case 'cpp':case 'css':case 'dhtml':case 'diz':case 'h':case 'hpp':case 'htm':
case 'html':case 'in':case 'inc':case 'js':case 'm4':case 'mak':case 'nfs':
case 'nsi':case 'pas':case 'patch':case 'php':case 'php3':case 'php4':case 'php5':
case 'phtml':case 'pl':case 'po':case 'py':case 'qmail':case 'sh':case 'shtml':
case 'sql':case 'tcl':case 'tpl':case 'txt':case 'vbs':case 'xml':case 'xrc':
return FTP_ASCII;
}
return FTP_BINARY;
}

// sample usage
ftp_get($conn_id, $local_file, $server_file, get_ftp_mode($server_file));
?>
------解决方案--------------------
你用了二进制模式?
------解决方案--------------------
服务器一般都是放在防火墙后面,因此 FTP 客户端程序如果需要穿越防火墙,需要开启被动模式,否则执行任何 ftp 命令都没有响应,直到出现 “最大执行时间超时” 的致命错误,导致程序终止运行...

解决办法,可以参考:http://www.bacysoft.cn/thread-10-1-1.html

Related labels:
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