How to establish Ftp connection in php, php establish ftp_PHP tutorial

WBOY
Release: 2016-07-13 10:05:25
Original
737 people have browsed it

How to establish Ftp connection in php, how to establish ftp in php

This article describes the method of establishing Ftp connection in php. Share it with everyone for your reference. The specific analysis is as follows:

Today I looked at the ftp function and summarized it:

FTP related functions:

ftp_connect (host, part, timeout) Establish a new ftp connection, host is the server to be connected, part is the port, the default is 21, timeout is the network connection timeout

ftp_login(con,user,password) Log in to ftp, con is the ftp connection established upstream. There is also user user and password password

ftp_close(con) Close the con connection.

ftp_pasv(con,true) Turn on the passive transmission mode of con. Data is transferred by the client. Of course, this can only be executed if the login is successful.

ftp_put(con,remove,local,mode) Upload the file with local path to con and name it remove file. mode is the transfer mode (FTP_ASCII, FTP_BINARY)

Example below:

$host = 'host';
$user = 'user';
$pwd = 'pwd';
$con = ftp_connect($host);
$login = ftp_login($con,$user,$pwd);
echo ftp_put($con,'newname.txt','text.txt',FTP_ASCII);
ftp_close($con);
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/963824.htmlTechArticleHow to establish Ftp connection in php, php to establish ftp This article describes the method of establishing Ftp connection in php. Share it with everyone for your reference. The specific analysis is as follows: I looked at the ftp function today and summarized...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!