位置: - 正文

PHP:ftp_fget()的用法_FTP函数(php教程 ftp 函数)

编辑:rootadmin
ftp_fget

推荐整理分享PHP:ftp_fget()的用法_FTP函数(php教程 ftp 函数),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php fgetc,php ftell,phpstudy ftp怎么用,php ftp管理系统,phpstudy ftp怎么用,php教程 ftp 函数,php fgets,phpstudy ftp怎么用,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4, PHP 5)

ftp_fget — 从 FTP 服务器上下载一个文件并保存到本地一个已经打开的文件中

说明 bool ftp_fget ( resource $ftp_stream , resource $handle , string $remote_file , int $mode [, int $resumepos = 0 ] )

ftp_fget() 函数用来下载由 remote_file 指定的文件,并写入到本地已经被打开的一个文件中。

参数

ftp_stream

FTP 连接的链接标识符。

handle

本地已经打开的文件的句柄。

remote_file PHP:ftp_fget()的用法_FTP函数(php教程 ftp 函数)

远程文件的路径。

mode

传送模式参数, 必须是 (文本模式) FTP_ASCII 或 (二进制模式) FTP_BINARY 中的一个。

resumepos

远程文件开始下载的位置。

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE。

范例

Example #1 ftp_fget() 例子

<?php//pathtoremotefile$remote_file='somefile.txt';$local_file='localfile.txt';//opensomefiletowriteto$handle=fopen($local_file,'w');//setupbasicconnection$conn_id=ftp_connect($ftp_server);//loginwithusernameandpassword$login_result=ftp_login($conn_id,$ftp_user_name,$ftp_user_pass);//trytodownload$remote_fileandsaveitto$handleif(ftp_fget($conn_id,$handle,$remote_file,FTP_ASCII,0)){echo"successfullywrittento$local_filen";}else{echo"Therewasaproblemwhiledownloading$remote_fileto$local_filen";}//closetheconnectionandthefilehandlerftp_close($conn_id);fclose($handle);?>

更新日志

版本 说明 4.3.0 增加了resumepos 的支持。

参见

ftp_get() - 从 FTP 服务器上下载一个文件 ftp_nb_get() - 从 FTP 服务器上获取文件并写入本地文件(non-blocking) ftp_nb_fget() - 从 FTP 服务器获取文件并写入到一个打开的文件(非阻塞)

PHP:ftp_exec()的用法_FTP函数 ftp_exec(PHP4=4.0.3,PHP5)ftp_exec请求运行一条FTP命令说明boolftp_exec(resource$ftp_stream,string$command)发送一个SITEEXECcommand请求到FTP服务器。如果成功(服务器发送响

PHP:ftp_delete()的用法_FTP函数 ftp_delete(PHP4,PHP5)ftp_delete删除FTP服务器上的一个文件说明boolftp_delete(resource$ftp_stream,string$path)ftp_delete()函数用来删除FTP服务器上的一个由参数path指定的的

PHP:ftp_connect()的用法_FTP函数 ftp_connect(PHP4,PHP5)ftp_connect建立一个新的FTP连接说明resourceftp_connect(string$host[,int$port[,int$timeout]])如果成功返回一个连接标识,失败则返回FALSE。ftp_connect()

本文链接地址:https://www.jiuchutong.com/biancheng/280539.html 转载请保留说明!
下一篇链接:https://www.jiuchutong.com/biancheng/280540.html
免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络