Home PHP Libraries Other libraries PHP operation ftp class
PHP operation ftp class
<?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



Disclaimer

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

[ftp operation class] 8 php ftp operation class libraries download [ftp operation class] 8 php ftp operation class libraries download

20 May 2017

FTP is a file transfer protocol that provides client access to the file server through the File Transfer Protocol (FTP). It is used to open, log in, and close connections, and is also used to upload, download, rename, delete, and obtain files on the server. file information. PHP Chinese website provides you with 8 practical PHP ftp operation libraries for your study and reference.

php python ftp operation class php python ftp operation class

25 Jul 2016

php python ftp operation class

[Database Operation Class] 10 PHP database operation classes download [Database Operation Class] 10 PHP database operation classes download

19 May 2017

Database operation is an important part of the development process, and being proficient in database operation is an essential weapon for developers. PHP Chinese website provides you with various encapsulated PHP database operation libraries for you to download and learn.

PHP operation FTP class (upload, download, move, create, etc.) PHP operation FTP class (upload, download, move, create, etc.)

06 Jan 2017

This article mainly introduces PHP to operate the FTP class to realize FTP upload, FTP download, FTP move, FTP creation, etc. Interested friends can refer to it.

PHP database operation class based on pdo PHP database operation class based on pdo

22 Jun 2018

This article mainly introduces PHP's pdo-based database operation class, which can implement basic database connections, additions, deletions, modifications, and connections, etc. It also supports operations on mysql, sqlserver, oracle and other databases. Friends in need can refer to the following

XML operation class implemented by PHP [XML Library] XML operation class implemented by PHP [XML Library]

06 Jan 2017

This article mainly introduces the XML operation class implemented by PHP, involving PHP's conversion, serialization, deserialization and other related operation skills for arrays and xml. Friends in need can refer to the following

See all articles