在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
<? $ftp_user = "foo"; $ftp_pass = "bar"; //连接ftp服务器 $con=ftp_connect($ftp_server); //发送用户名和密码 ftp_login($con,$ftp_user,$ftp_pass); //取得服务器的系统类型 ftp_systype($con); //列出文件 $filelist=ftp_nlist($con,"/"); foreach ($contents as $entry) { echo $entry, "<br />\n"; //下载文件 $local_file = 'local.zip'; $server_file = 'server.zip'; $down=ftp_get($con,$local_file,$server_file,FTP_BINARY); if(!$down){ echo "no!"; }else{ echo "ok!"; //获得当前路径 echo ftp_pwd($con); echo "<br>"; //改变路径 ftp_chdir($con,"somedir"); echo ftp_pwd($con); //返回刚才的目录 ftp_cdup($con);
//创建文件夹,删除的函数为ftp_rmdir($con,$dir) $mkdir=ftp_mkdir($con,"test"); //上传文件 ftp_put($con,$destination_file, $source_file,FTP_ASCII); //上传一个已经打开的文件到 FTP 服务器 $file = 'somefile.txt'; $fp = fopen($file, 'r'); ftp_fput($con, $file, $fp, FTP_ASCII) //关闭ftp连接 ftp_close($con); |
2022-08-15
2022-08-17
2022-11-06
2022-08-17
2022-07-18
请发表评论