<?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 "文件上传失败,请检查权限及路径是否正确!"; }
Method: FTP connection
@FTP_HOST -- FTP host
@FTP_PORT --Port
@FTP_USER --Username
@ FTP_PASS -- Password
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article

12Jul2016
PHP operates FTP classes (upload, download, move, create, etc.), phpftp. PHP operates FTP classes (upload, download, move, create, etc.), phpftp This article provides a detailed introduction to PHP operating FTP classes, php implements FTP upload, FTP download, FTP move, FTP creation, etc. for your reference

06Jul2016
What are some very useful class libraries or tool libraries for PHP?

06Jul2016
PHP value mysql operation class, php value mysql. PHP value mysql operation class, php value mysql ?php/** * Created by PhpStorm. * User: Administrator * Date: 2016/6/27 * Time: 18:55 */Class Mysqls{ private $table; //table private $opt; public f

13Dec2024
Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

12Jul2016
PHP value mysql operation class, php value mysql. PHP value mysql operation class, php value mysql ?php/** * Created by PhpStorm. * User: Administrator * Date: 2016/6/27 * Time: 18:55 */Class Mysqls{ private $table; //table private $opt; public f

12Jul2016
A complete example of PHP database operation Helper class, phphelper. A complete example of the PHP database operation Helper class, phphelper This article describes the PHP database operation Helper class through examples. Share it with everyone for your reference, the details are as follows: PHP operation database is divided into several


Hot Tools

PHP library for dependency injection containers
PHP library for dependency injection containers

A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking

Small PHP library for optimizing images
Small PHP library for optimizing images
