php的操作ftp類
<?php class ftp { public $off; // 返回操作状态(成功/失败) public $conn_id; // FTP连接 function __construct($FTP_HOST,$FTP_PORT,$FTP_USER,$FTP_PASS) { $this->conn_id = @ftp_connect($FTP_HOST,$FTP_PORT) or die("FTP服务器连接失败"); @ftp_login($this->conn_id,$FTP_USER,$FTP_PASS) or die("FTP服务器登陆失败"); @ftp_pasv($this->conn_id,1); // 打开被动模拟 } function up_file($path,$newpath,$type=true) { if($type) $this->dir_mkdirs($newpath); $this->off = @ftp_put($this->conn_id,$newpath,$path,FTP_BINARY); if(!$this->off) echo "文件上传失败,请检查权限及路径是否正确!"; }
方法:FTP連線
@FTP_HOST -- FTP主機
#@FTP_PORT -- 埠
@FTP_USER -- 使用者名稱
@ FTP_PASS -- 密碼
免責聲明
本站所有資源皆由網友貢獻或各大下載網站轉載。請自行檢查軟體的完整性!本站所有資源僅供學習參考。請不要將它們用於商業目的。否則,一切後果都由您負責!如有侵權,請聯絡我們刪除。聯絡方式:admin@php.cn
相關文章

19Oct2024
如何使用 jQuery 迭代具有相同類別的元素當使用相同類別的多個元素時,有必要單獨存取和操作它們。 jQuery 提供了一種有效的方法來循環這些元素

21Jul2016
PHP中對資料庫操作的封裝。 PHP中對資料庫操作的封裝 在動態網面設計中很多都要涉及到對資料庫的操作,但是有時跟據需要而改用其它後台資料庫,就需要大量修改程序


Hot Tools

熱門文章
丟失記錄:Bloom&Rage -Corey和Dylan的鎖組合
19Feb2025手游攻略
Hello Kitty 島冒險:巧克力貓角色指南
24Jan2025手游攻略
如何修復KB5050081無法在Windows 10中安裝?
31Jan2025故障排查
AI Checkers可能會標記您的寫作的4個原因,即使您不使用Chatgpt
27Jan2025人工智慧
Hello Kitty Island冒險:重新啟動機器人任務演練
16Feb2025手游攻略